日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

国际时间按时区索引号转换

發(fā)布時(shí)間:2024/1/18 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 国际时间按时区索引号转换 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

typedef struct{int year; int month; int day;int hour;int minute;int second;int millisecond; }DATE_TIME;typedef struct{DATE_TIME D; //時(shí)間char status; //接收狀態(tài)double latitude; //緯度double longitude; //經(jīng)度char NS; //南北緯char EW; //東西經(jīng)double speed; //速度double high; //高度 }GPS_INFO;typedef struct{BYTE ucTimeZone; //時(shí)區(qū)編號(hào)INT addOrSub; //時(shí)間加減INT hour; //時(shí)INT minute; //分 }T_TimeZoneOffset; /*時(shí)區(qū)對(duì)應(yīng)偏移量*/T_TimeZoneOffset gTimeZoneOffsetTable[] = {{0 ,-1,12,00},{2 ,-1,11,00},{4 ,-1,10,00},{6 ,-1,9 ,00},{8 ,-1,8 ,00},{10,-1,7 ,00},{12,-1,6 ,00},{14,-1,5 ,00},{15,-1,4 ,30},{16,-1,4 ,00},{17,-1,3 ,30},{18,-1,3 ,00},{20,-1,2 ,00},{22,-1,1 ,00},{24, 0,0 ,00},{26,+1,1 ,00},{28,+1,2 ,00},{30,+1,3 ,00},{31,+1,3 ,30},{32,+1,4 ,00},{33,+1,4 ,30},{34,+1,5 ,00},{35,+1,5 ,30},{51,+1,5 ,45},{36,+1,6 ,00},{37,+1,6 ,30},{38,+1,7 ,00},{40,+1,8 ,00},{42,+1,9 ,00},{43,+1,9 ,30},{44,+1,10,00},{46,+1,11,00},{48,+1,12,00},{50,+1,13,00}, };VOID BspConvertTimeToLocal(BYTE ucTimeZoneIndex, DATE_TIME *GPS) {WORD32 dwLoop;INT sPn = 0;INT hour = 0;INT minute = 0;/*時(shí)區(qū)查找*/for(dwLoop=0; dwLoop<sizeof(gTimeZoneOffsetTable)/sizeof(T_TimeZoneOffset); dwLoop++){if(ucTimeZoneIndex == gTimeZoneOffsetTable[dwLoop].ucTimeZone){sPn = gTimeZoneOffsetTable[dwLoop].addOrSub;hour = gTimeZoneOffsetTable[dwLoop].hour;minute = gTimeZoneOffsetTable[dwLoop].minute;break;}}if(sPn >= 0) //東部時(shí)區(qū){/*分處理*/gpsInfo.D.minute = gpsInfo.D.minute + minute;if(gpsInfo.D.minute>59){gpsInfo.D.minute -= 60;gpsInfo.D.hour++;}/*時(shí)處理*/gpsInfo.D.hour = gpsInfo.D.hour + hour;if(gpsInfo.D.hour>23){gpsInfo.D.hour-=24;gpsInfo.D.day+=1;if(gpsInfo.D.month==2 ||gpsInfo.D.month==4 ||gpsInfo.D.month==6 ||gpsInfo.D.month==9 ||gpsInfo.D.month==11 ){if(gpsInfo.D.day>30){ //上述幾個(gè)月份是30天每月,2月份還不足30gpsInfo.D.day=1;gpsInfo.D.month++;}}else{if(gpsInfo.D.day>31){ //剩下的幾個(gè)月份都是31天每月gpsInfo.D.day=1;gpsInfo.D.month++;}}if(gpsInfo.D.year % 4 == 0 ){//if(gpsInfo.D.day > 29 && gpsInfo.D.month ==2){ //閏年的二月是29天gpsInfo.D.day=1;gpsInfo.D.month++;}}else{if(gpsInfo.D.day>28 &&gpsInfo.D.month ==2){ //其他的二月是28天每月gpsInfo.D.day=1;gpsInfo.D.month++;}}if(gpsInfo.D.month>12){gpsInfo.D.month-=12;gpsInfo.D.year++;} }}else //西部時(shí)區(qū){/*分處理*/gpsInfo.D.minute = gpsInfo.D.minute - minute;if(gpsInfo.D.minute<0){gpsInfo.D.minute += 60;gpsInfo.D.hour--;}/*時(shí)處理*/gpsInfo.D.hour = gpsInfo.D.hour - hour;if(gpsInfo.D.hour<0){gpsInfo.D.hour+=24;gpsInfo.D.day--;if(gpsInfo.D.day <= 0){gpsInfo.D.month--;if (gpsInfo.D.month==1 ||gpsInfo.D.month==3 ||gpsInfo.D.month==5 ||gpsInfo.D.month==7 ||gpsInfo.D.month==8||gpsInfo.D.month==10){gpsInfo.D.day = 31;}else if (gpsInfo.D.month==4 ||gpsInfo.D.month==6 ||gpsInfo.D.month==9 ||gpsInfo.D.month==11){gpsInfo.D.day = 30;}else if (gpsInfo.D.month==2){if(gpsInfo.D.year % 4 == 0 ) //閏年的二月是29天{gpsInfo.D.day = 29;}else //其他的二月是28天每月{gpsInfo.D.day = 28;}}else /*month=0,year--,month=12*/{gpsInfo.D.day = 31;gpsInfo.D.month = 12;gpsInfo.D.year--;}}}}}

總結(jié)

以上是生活随笔為你收集整理的国际时间按时区索引号转换的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。