SQLite

Check-in [02fac304c9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make the sqliteOsCurrentTime() function work for Windows. Code contributed by "e4liberty" on the mailing list. (CVS 1071)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 02fac304c9ec9012f3cc4f04d2c4cac5e37b0024
User & Date: drh 2003-08-10 16:16:22.000
Context
2003-08-13
11:29
Update the NULL-handling chart with new information about Firebird. (CVS 1072) (check-in: 17bdfeb284 user: drh tags: trunk)
2003-08-10
16:16
Make the sqliteOsCurrentTime() function work for Windows. Code contributed by "e4liberty" on the mailing list. (CVS 1071) (check-in: 02fac304c9 user: drh tags: trunk)
01:50
tighter coding of the date and time functions. Better comments. A bug fix. (CVS 1070) (check-in: 94243edac1 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/os.c.
1606
1607
1608
1609
1610
1611
1612












1613
1614
int sqliteOsCurrentTime(double *prNow){
#if OS_UNIX
  time_t t;
  time(&t);
  *prNow = t/86400.0 + 2440587.5;
  return 0;
#endif












  return 1;
}







>
>
>
>
>
>
>
>
>
>
>
>


1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
int sqliteOsCurrentTime(double *prNow){
#if OS_UNIX
  time_t t;
  time(&t);
  *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;
}