System Time

System time is the current date and time of day. The system keeps time so that your applications have ready access to accurate time. When the system first starts, it sets the system time to a value based on the real-time clock of the computer and then regularly updates the time.

The system bases system time on coordinated universal time (UTC). UTC-based time is loosely defined as the current date and time of day in Greenwich, England. You can retrieve the system time by using the GetSystemTime function. GetSystemTime copies the time to a SYSTEMTIME structure that contains individual members for month, day, year, weekday, hour, minute, second, and milliseconds. It is easy to display this format to a user.

You can set the system time by using the SetSystemTime function. SetSystemTime assumes you have specified a UTC-based time. If you change the system time, you should send the WM_TIMECHANGE message to all top-level windows by using the SendMessage function.

The GetSystemTimeAdjustment and SetSystemTimeAdjustment functions synchronize the time-of-day clock with another time source using a periodic time adjustment applied at each clock interrupt.