Home > Software engineering >  How to get the local real time?
How to get the local real time?

Time:04-13

I use the CTime: : GetCurrentTime () to obtain time; But access is only the time displayed on the computer, the time is not necessarily correct,

How to obtain real time?

I want to do with real time and computer time, determine the computer time is correct

CodePudding user response:

Search the NTP SNTP, network timing protocol


CodePudding user response:

Also, use CTime: : GetCurrentTime (), a % X minutes, when you will get what can separate for hours, minutes and seconds

CodePudding user response:

https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-6.0/aa315344 (60) v=vs.

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 of 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).

CodePudding user response:

So, thank the bosses

CodePudding user response:

Every time you can take time before the synchronization
Call w32tm/resync command Windows's own time synchronization
  • Related