当前位置:网站首页>解锁时间生成与比较
解锁时间生成与比较
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;
}边栏推荐
- redis distributed lock code example
- 《动手学深度学习》(八) -- 多尺度标检测和单发多框检测
- 直播app开发搭建,flutter 实现自适应、自动换行、相对布局
- 【JZOF】77按之字形打印二叉树
- 技术盛宴!华云数据携六大议题亮相OpenInfra Days China
- What are the Shenzhen fortress machine manufacturers?Which one do you recommend?
- 十位时间戳转化成时间
- 分布式数据库难题(二):数据复制
- ES6 Beginner to Mastery #13: Extension Methods for Arrays 2
- Dry goods!Towards robust test-time adaptation
猜你喜欢

IT传奇人物菲尔德的转型经验教训及给CIO的建议

Wireshark classic practice and interview 13-point summary

什么是平面文件数据库? 如何导入多种格式的文件:DSV、JSON、XML?

【云原生】一文讲透Kubevela addon如何添加腾讯Crane

Gartner's global integrated system market data tracking, hyperconverged market growth rate is the first

完全背包理论

Technology feast!Huayun Data brings six topics to OpenInfra Days China

数据库优化 | 干货

数字钱包红海角逐,小程序生态快速引入可助力占领智慧设备入口

ES6 Beginner to Mastery #13: Extension Methods for Arrays 2
随机推荐
AUTOCAD——形位公差如何标注、CAD打断于点的操作
工程 (七) ——PolarSeg点云语义分割
什么是平面文件数据库? 如何导入多种格式的文件:DSV、JSON、XML?
如何知道电脑开机记录?
带着昇腾去旅行:一日看尽金陵城里的AI胜景
阿里云短信服务开通
【集训DAY3】挖金矿【二分答案】
【JZOF】82二叉树中和为某一值的路径(一)
【集训DAY3】石油储备计划【树形DP】
数字钱包红海角逐,小程序生态快速引入可助力占领智慧设备入口
《GB5084-2021》PDF下载
Click: 377. Combined Sum Ⅳ
南大通用数据库-Gbase-8a-学习-04-部署分布式集群
framework源码读后感
Cmake 用法记录
恭喜获奖得主 | 互动有礼获赠 Navicat Premium
Sqlserver限制账户在哪些ip下才可以访问数据库
6款跨境电商常用工具汇总
781. 森林中的兔子
MVC与MVVM模式的区别