mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Make the sqliteOsCurrentTime() function work for Windows. Code contributed
by "e4liberty" on the mailing list. (CVS 1071) FossilOrigin-Name: 02fac304c9ec9012f3cc4f04d2c4cac5e37b0024
This commit is contained in:
12
src/os.c
12
src/os.c
@@ -1610,5 +1610,17 @@ int sqliteOsCurrentTime(double *prNow){
|
||||
*prNow = t/86400.0 + 2440587.5;
|
||||
return 0;
|
||||
#endif
|
||||
#if OS_WIN
|
||||
FILETIME ft;
|
||||
/* FILETIME structure is a 64-bit value representing the number of
|
||||
100-nanosecond intervals since January 1, 1601 (= JD 2305813.5).
|
||||
*/
|
||||
double now;
|
||||
GetSystemTimeAsFileTime( &ft );
|
||||
now = ((double)ft.dwHighDateTime) * 4294967296.0;
|
||||
*prNow = (now + ft.dwLowDateTime)/864000000000.0 + 2305813.5;
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user