当前位置:网站首页>解锁时间生成与比较
解锁时间生成与比较
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;
}
边栏推荐
- 分布式数据库难题(三):数据一致性
- LiveData : Transformations.map and Transformations.switchMap usage
- ECCV 2022 | 微软开源TinyViT :搞定小模型的预训练能力
- 【集训DAY5】选数字【数学】
- 基于 RocksDB 实现高可靠、低时延的 MQTT 数据持久化
- What are the Shenzhen fortress machine manufacturers?Which one do you recommend?
- 如何正则匹配乱码?
- CAD 绘制圆角处理
- Technology feast!Huayun Data brings six topics to OpenInfra Days China
- 力扣:322. 零钱兑换
猜你喜欢
随机推荐
2022年最新《谷粒学院开发教程》:10 - 前台支付模块
CAD 截断线段
Gartner's global integrated system market data tracking, hyperconverged market growth rate is the first
[Cloud native] Kubernetes orchestration tools
Jpa 查询view or 无主键的table
68.qt quick-qml多级折叠下拉导航菜单 支持动态添加/卸载 支持qml/widget加载等
ES6 Beginner to Mastery #13: Extension Methods for Arrays 2
【mysql】查询今天9点
Pinduoduo store operation must know to leave a little knowledge of operation
服务发现@EnableDiscoveryClient
What are the Shenzhen fortress machine manufacturers?Which one do you recommend?
【接口测试】requests 库请求体字符串解码
多商户商城系统功能拆解25讲-平台端分销申请
Live Preview | ICML 2022 11 first-author scholars share online neural network, graph learning and other cutting-edge research
2022-08-09 mysql/stonedb-慢SQL-Q16分析
力扣:474.一和零
分布式数据库难题(二):数据复制
【集训DAY5】堆箱子【数学】
Gumbel distribution of discrete choice model
Explore the TiDB Lightning source code to solve the found bugs