当前位置:网站首页>解锁时间生成与比较
解锁时间生成与比较
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;
}
边栏推荐
猜你喜欢
[Cloud native] Kubernetes orchestration tools
A summary of 6 common tools for cross-border e-commerce
FreeRTOS任务基础
ABAP中Collect的用法
The latest "Grain Academy Development Tutorial" in 2022: 10 - Front-end payment module
2022-08-09 mysql/stonedb-子查询性能提升-概论
Golden Warehouse Database KingbaseGIS User Manual (6.4. Geometry Object Access Function)
【集训DAY5】快速排序【模拟】【数学】
【云原生】一文讲透Kubevela addon如何添加腾讯Crane
MVC与MVVM模式的区别
随机推荐
How to know the computer boot record?
NotWritableError: The current user does not have write permissions when conda creates a new environment
Click: 377. Combined Sum Ⅳ
Force Buckle: 474. Ones and zeros
LeetCode952三部曲之三:再次优化(122ms -> 96ms,超51% -> 超91%)
SRv6 performance measurement
用哈希简单封装unordered_map和unordered_set
Dry goods!Towards robust test-time adaptation
complete knapsack theory
【Infiltration tool】Browser data export tool
【SSL集训DAY2】Sort【树状数组】
【SSL集训DAY2】有趣的数【数位DP】
Digital wallets, red sea ecological rapid introduction of small programs can help capture device entry wisdom
分布式数据库难题(三):数据一致性
70. Stair Climbing Advanced Edition
68.qt quick-qml多级折叠下拉导航菜单 支持动态添加/卸载 支持qml/widget加载等
力扣:474.一和零
Snap: 322. Change of Change
Wireshark经典实践和面试13点总结
What are the Shenzhen fortress machine manufacturers?Which one do you recommend?