当前位置:网站首页>解锁时间生成与比较
解锁时间生成与比较
2022-08-09 22:50:00 【硬件狗】
Date_Unlock_Gen()
说明:假代码,用于生成解锁的时间节点。
unsigned int Date_Unlock_Comp()
说明:假代码,比较当前时间是否超过生成的时间节点,并返回是否进行解锁。
Date_Unlock_Gen()
{
//Define Lock_Minute
unsigned int Lock_Minute; //Max=255/3*15/60=21.25Hour
//Get Date_Now
unsigned int Year_Now=2022;
unsigned int Month_Now=8;
unsigned int Day_Now=9;
unsigned int Hour_Now=10;
unsigned int Minute_Now=42;
//Define Date_Unlock
unsigned int Year_Unlock;
unsigned int Month_Unlock;
unsigned int Day_Unlock;
unsigned int Hour_Unlock;
unsigned int Minute_Unlock;
static unsigned int Hour1_Unlock;
static unsigned int Day1_Unlock;
//Initiate date unlocked
Month_Unlock=Month_Now;
Day_Unlock=Day_Now;
Hour_Unlock=Hour_Now;
Minute_Unlock=Minute_Now;
Minute_Unlock=(Minute_Now+Lock_Minute)%60;
Hour1_Unlock=Hour_Now+(Minute_Now+Lock_Minute)/60;
Hour_Unlock=Hour1_Unlock%24;
Day1_Unlock=Day_Now+Hour1_Unlock/24;
if(Day1_Unlock>31&&(Month_Now==1||Month_Now==3||Month_Now==5||Month_Now==7||Month_Now==8||Month_Now==10||Month_Now==12))
{
Day_Unlock=Day1_Unlock%31;
Month_Unlock=Month_Now+Day1_Unlock/31;
if(Month_Unlock>12)
{
Month_Unlock=Month_Unlock%12;
Year_Unlock=Year_Now+Month_Unlock/12;
}
}
if(Day1_Unlock>30&&(Month_Now==4||Month_Now==6||Month_Now==9||Month_Now==11))
{
Day_Unlock=Day1_Unlock%30;
Month_Unlock=Month_Now+Day1_Unlock/30;
}
if(Day1_Unlock>28&&(Month_Now==2))
{
if(Year_Now%4==0)
{
Day_Unlock=Day1_Unlock%29;
Month_Unlock=Month_Now+Day1_Unlock/29;
}
else
{
Day_Unlock=Day1_Unlock%28;
Month_Unlock=Month_Now+Day1_Unlock/28;
}
}
}
unsigned int Date_Unlock_Comp()
{
unsigned int Unlock=0;
unsigned int Lock=1;
//Get Date_Now and Date_Unlock
unsigned int Year_Now=2022;
unsigned int Month_Now=8;
unsigned int Day_Now=9;
unsigned int Hour_Now=10;
unsigned int Minute_Now=42;
unsigned int Year_Unlock=2022;
unsigned int Month_Unlock=8;
unsigned int Day_Unlock=8;
unsigned int Hour_Unlock=8;
unsigned int Minute_Unlock=8;
//Compare
if(Year_Now>Year_Unlock)
return Unlock;
else
if(Month_Now>Month_Unlock)
return Unlock;
else
if(Day_Now>Day_Unlock)
return Unlock;
if(Hour_Now>Hour_Unlock)
return Unlock;
if(Minute_Now>Minute_Unlock)
return Unlock;
else
return Lock;
}边栏推荐
- 力扣:518. 零钱兑换 II
- 你的手机曾经被监控过吗?
- Golden Warehouse Database KingbaseGIS User Manual (6.5. Geometry Object Editing Function)
- [JZOF] 82 binary tree with a path of a certain value (1)
- 【集训DAY4】矩形【线段树】
- FreeRTOS任务基础
- Gartner's global integrated system market data tracking, hyperconverged market growth rate is the first
- SRv6性能测量
- 2022年最新《谷粒学院开发教程》:10 - 前台支付模块
- 【集训DAY5】堆箱子【数学】
猜你喜欢
随机推荐
ES6 从入门到精通 # 12:数组的扩展方法一
软考 --- 软件工程(7)软件项目管理(下)
完全背包理论
ALV报表总结2022.8.9
多商户商城系统功能拆解25讲-平台端分销申请
Digital wallets, red sea ecological rapid introduction of small programs can help capture device entry wisdom
Click: 518. Change Exchange II
SRv6性能测量
Wireshark经典实践和面试13点总结
Sqlserver限制账户在哪些ip下才可以访问数据库
LiveData : Transformations.map和 Transformations.switchMap用法
【集训DAY3】石油储备计划【树形DP】
2022-08-09 mysql/stonedb-subquery performance improvement-introduction
Live Preview | ICML 2022 11 first-author scholars share online neural network, graph learning and other cutting-edge research
harbor配置远程仓库
Gartner全球集成系统市场数据追踪,超融合市场增速第一
恭喜获奖得主 | 互动有礼获赠 Navicat Premium
MVC与MVVM模式的区别
redis分布式锁代码示例
防火墙之系统防护









