当前位置:网站首页>获取的网络时间 + 时区(+8)
获取的网络时间 + 时区(+8)
2022-06-10 19:51:00 【qq_755682240】
代码如下所示:
#include <stdio.h>
// 小时 周 日 月 年
unsigned int hours, wday, day, mon, year;
//对获取的网络时间 + 时区(+8)
void time_8(void){
hours+=8;
if(hours>23){
//时间大于24小时后,则为明天的日期
day += 1;
switch(mon){
//闰年判断-->日赋值
case 1:case 3:case 5:case 7:case 8:case 10:case 12:
day %= 32;if(day==0){
day=1;mon+=1;if(mon==13){
mon=1;year+=1;}}break;
case 4:case 6:case 9:case 11:
day %= 31;if(day==0){
day=1;mon+=1;if(mon==13){
mon=1;year+=1;}}break;
case 2:
if((year%4) == 0) {
day %= 30;if(day==0){
day=1;mon+=1;if(mon==13){
mon=1;year+=1;}}}
else {
day %= 29;if(day==0){
day=1;day+=1;if(mon==13){
mon=1;year+=1;}}}break;
}
if((wday+1) == 8)wday=1;//周赋值
hours=hours%24;//小时赋值
}
}
int main(){
/* 我的 C 程序 */
printf("Hello, World! \n");
time_8();//对获取的网络时间 + 时区(+8)
printf("%d %d/%d/%d %d: \n",wday,year,mon,day,hours);
return 0;
}
边栏推荐
- Can you still have a wonderful life if you are laid off at the age of 35?
- In depth learning experience and tools
- 牛客网:数组中出现次数超过一半的数字
- node(express)实现增删改查、分页等接口
- 【Educational Codeforces Round 120 (Rated for Div. 2)】C. Set or Decrease
- 请问九洲期货是正规的吗?开户安不安全
- Vertical bar of latex tips absolute value \left\right|
- Talk about server performance optimization ~ (recommended Collection)
- The old programmer said: stop translating the world, developers should return to programming
- uni-app自定义导航
猜你喜欢

pdf.js-----js解析pdf文件实现预览,并获取pdf文件中的内容(数组形式)

Mysql database foundation

CVPR 2022 Tsinghua University proposed unsupervised domain generalization (UDG)

Quick start to elastic job, three minutes to experience distributed scheduled tasks

Microsoft Word tutorial "5", how to change the margins and create a newsletter column in word?

Magic tower game implementation source code and level generation

Deploying static websites using OSS and CDN on Alibaba cloud international

LeetCode:1037. Effective boomerang - simple

2台电脑共享一套键盘鼠标

Tutoriel Microsoft Word "5", comment changer les marges de page et créer une barre de nouvelles en word?
随机推荐
LeetCode:1037. Effective boomerang - simple
How to use Diablo immortal database
Portable FDW framework for Pb
mixin--混入
vulnhub-The Planets: Earth
Pytorch deep learning -- convolution operation and code examples
Connexion MySQL errorcode 1129, State hy000, Host 'xxx' is Blocked because of many Connection Errors
pytorch深度学习——神经网络卷积层Conv2d
vulnhub-The Planets: Earth
Is Zhongyan futures reliable? Is it a regular futures company? Is it safe to open an account?
聊聊服务器性能优化~(建议收藏)
割舍绳子/整数分割
Four methods to obtain the position index of the first n values of the maximum and minimum values in the list
LeetCode:497. Random points in non overlapping rectangles -- medium
The excess part of the table setting is hidden. Move the mouse to display all
六级考试-商务英语-考前最后一背
PDF. JS - - - - JS analyse le fichier PDF pour réaliser l'aperçu et obtenir le contenu du fichier PDF (sous forme de tableau)
The most common habits from more than 200 English papers written by gradua
redis设置密码命令(临时密码)
Uni app custom navigation