comparison lib/gettimeofday.c @ 40235:5a52ef2d4772

all: Update URLs to msdn.microsoft.com. * lib/stat-w32.c et al.: Update URLs after most of msdn.microsoft.com was moved to docs.microsoft.com.
author Bruno Haible <bruno@clisp.org>
date Thu, 14 Mar 2019 09:49:24 +0100
parents b06060465f09
children
comparison
equal deleted inserted replaced
40234:fab7ce42e03f 40235:5a52ef2d4772
70 #undef gettimeofday 70 #undef gettimeofday
71 #ifdef WINDOWS_NATIVE 71 #ifdef WINDOWS_NATIVE
72 72
73 /* On native Windows, there are two ways to get the current time: 73 /* On native Windows, there are two ways to get the current time:
74 GetSystemTimeAsFileTime 74 GetSystemTimeAsFileTime
75 <https://msdn.microsoft.com/en-us/library/ms724397.aspx> 75 <https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime>
76 or 76 or
77 GetSystemTimePreciseAsFileTime 77 GetSystemTimePreciseAsFileTime
78 <https://msdn.microsoft.com/en-us/library/hh706895.aspx>. 78 <https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime>.
79 GetSystemTimeAsFileTime produces values that jump by increments of 79 GetSystemTimeAsFileTime produces values that jump by increments of
80 15.627 milliseconds (!) on average. 80 15.627 milliseconds (!) on average.
81 Whereas GetSystemTimePreciseAsFileTime values usually jump by 1 or 2 81 Whereas GetSystemTimePreciseAsFileTime values usually jump by 1 or 2
82 microseconds. 82 microseconds.
83 More discussion on this topic: 83 More discussion on this topic:
90 GetSystemTimePreciseAsFileTimeFunc (&current_time); 90 GetSystemTimePreciseAsFileTimeFunc (&current_time);
91 else 91 else
92 GetSystemTimeAsFileTime (&current_time); 92 GetSystemTimeAsFileTime (&current_time);
93 93
94 /* Convert from FILETIME to 'struct timeval'. */ 94 /* Convert from FILETIME to 'struct timeval'. */
95 /* FILETIME: <https://msdn.microsoft.com/en-us/library/ms724284.aspx> */ 95 /* FILETIME: <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime> */
96 ULONGLONG since_1601 = 96 ULONGLONG since_1601 =
97 ((ULONGLONG) current_time.dwHighDateTime << 32) 97 ((ULONGLONG) current_time.dwHighDateTime << 32)
98 | (ULONGLONG) current_time.dwLowDateTime; 98 | (ULONGLONG) current_time.dwLowDateTime;
99 /* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89 leap 99 /* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89 leap
100 years, in total 134774 days. */ 100 years, in total 134774 days. */