我用CTime::GetCurrentTime()獲取時間;但是獲取的只是電腦上顯示的時間而已,時間不一定正確,
怎么獲取真實的時間啊?
我想拿真實時間和電腦時間做對比,判斷電腦時間是否正確
uj5u.com熱心網友回復:
搜下 NTP SNTP, 網路授時協議uj5u.com熱心網友回復:
還有,用CTime::GetCurrentTime(),一個%X就會獲得時分秒,怎么辦才可以單獨獲得小時、分鐘、秒啊uj5u.com熱心網友回復:
https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-6.0/aa315344(v=vs.60)Extraction
TABLE 2
GetTime Returns a time_t that corresponds to this CTime object.
GetYear Returns the year that this CTime object represents.
GetMonth Returns the month that this CTime object represents (1 through 12).
GetDay Returns the day that this CTime object represents (1 through 31).
GetHour Returns the hour that this CTime object represents (0 through 23).
GetMinute Returns the minute that this CTime object represents (0 through 59).
GetSecond Returns the second that this CTime object represents (0 through 59).
GetDayOfWeek Returns the day of the week (1 for Sunday, 2 for Monday, and so forth).
uj5u.com熱心網友回復:
原來如此,感謝大佬uj5u.com熱心網友回復:
你可以每次取時間前同步呼叫 w32tm /resync 這是Windows自帶的時間同步命令
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/275223.html
標籤:基礎類
