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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

DSP学习 -- GPS时间校准电脑系统时间

發布時間:2025/3/15 windows 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 DSP学习 -- GPS时间校准电脑系统时间 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一、格林威治時間轉北京時間

GPS時間為格林威治時間,而 北京時間=GMT時間+8小時。
兩者轉換的算法:
參看:C語言實現格林威治時間轉北京時間

參看:STM32開發 – UTC、UNIX時間戳、北京時間之間的轉換

日期數據結構定義:

typedef struct {uint16_t year;uint8_t month;uint8_t day;uint8_t hour;uint8_t minute;uint8_t second; }time_t;

轉換實現:

void UTCToBeijing(time_t* time) {uint8_t days = 0;if (time->month == 1 || time->month == 3 || time->month == 5 || time->month == 7 || time->month == 8 || time->month == 10 || time->month == 12){days = 31;}else if (time->month == 4 || time->month == 6 || time->month == 9 || time->month == 11){days = 30;}else if (time->month == 2){if ((time->year % 400 == 0) || ((time->year % 4 == 0) && (time->year % 100 != 0))) /* 判斷平年還是閏年 */{days = 29;}else{days = 28;}}time->hour += 8; /* 北京時間比格林威治時間快8小時 */if (time->hour >= 24) /* 跨天 */{time->hour -= 24;time->day++;if (time->day > days) /* 跨月 */{time->day = 1;time->month++;if (time->month > 12) /* 跨年 */{time->year++;}}} }

二、設置系統時間

使用 date time這兩個DOC指令
例如:

date 2020.11.11 & time 11:11:11

三、Visual Studio編譯生成的應用以管理員身份運行配置

如果需要以管理員身份運行,需要如下配置:
屬性->鏈接器->清單文件->UAC執行級別
選擇 requireAdministrator (/level=‘requireAdministrator’)

總結

以上是生活随笔為你收集整理的DSP学习 -- GPS时间校准电脑系统时间的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。