/ Check-in [7ef36935]
Login

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

Overview
Comment:Avoid all use of the "LL" suffix for long-long integer literals. Ticket #3759. (CVS 6408)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:7ef36935424013a1b211906620954a97ffe08de7
User & Date: drh 2009-03-30 12:42:45
Context
2009-03-30
12:56
Avoid calls to newer TCL interfaces in the test logic. This helps the TCL test harness compile without warnings and link when using older versions of the TCL library. (CVS 6409) check-in: 1ad17637 user: drh tags: trunk
12:42
Avoid all use of the "LL" suffix for long-long integer literals. Ticket #3759. (CVS 6408) check-in: 7ef36935 user: drh tags: trunk
11:59
Display a warning that the notify2-3 test sometimes fails on single-core machines. (CVS 6407) check-in: ab7c718d user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
1760
1761
1762
1763
1764
1765
1766
1767











1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782

1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains code that is specific to windows.
**
** $Id: os_win.c,v 1.150 2009/03/05 05:54:55 shane Exp $
*/
#include "sqliteInt.h"
#if SQLITE_OS_WIN               /* This file is used for windows only */


/*
** A Note About Memory Allocation:
................................................................................
** return 0.  Return 1 if the time and date cannot be found.
*/
int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){
  FILETIME ft;
  /* FILETIME structure is a 64-bit value representing the number of 
     100-nanosecond intervals since January 1, 1601 (= JD 2305813.5). 
  */
  sqlite3_int64 timeW, timeF;











#if SQLITE_OS_WINCE
  SYSTEMTIME time;
  GetSystemTime(&time);
  /* if SystemTimeToFileTime() fails, it returns zero. */
  if (!SystemTimeToFileTime(&time,&ft)){
    return 1;
  }
#else
  GetSystemTimeAsFileTime( &ft );
#endif
  UNUSED_PARAMETER(pVfs);
#if defined(_MSC_VER)
  timeW = (((sqlite3_int64)ft.dwHighDateTime)*4294967296) + ft.dwLowDateTime;
  timeF = timeW % 864000000000;           /* fractional days (100-nanoseconds) */
  timeW = timeW / 864000000000;           /* whole days */

  timeW = timeW + 2305813;                /* add whole days (from 2305813.5) */
  timeF = timeF + 432000000000;           /* add half a day (from 2305813.5) */
  timeW = timeW + (timeF / 864000000000); /* add whole day if half day made one */
  timeF = timeF % 864000000000;           /* compute new fractional days */
  *prNow = (double)timeW + ((double)timeF / (double)864000000000);
#else
  timeW = (((sqlite3_int64)ft.dwHighDateTime)*4294967296LL) + ft.dwLowDateTime;
  timeF = timeW % 864000000000LL;           /* fractional days (100-nanoseconds) */
  timeW = timeW / 864000000000LL;           /* whole days */
  timeW = timeW + 2305813;                  /* add whole days (from 2305813.5) */
  timeF = timeF + 432000000000LL;           /* add half a day (from 2305813.5) */
  timeW = timeW + (timeF / 864000000000LL); /* add whole day if half day made one */
  timeF = timeF % 864000000000LL;           /* compute new fractional days */
  *prNow = (double)timeW + ((double)timeF / (double)864000000000LL);
#endif
#ifdef SQLITE_TEST
  if( sqlite3_current_time ){
    *prNow = ((double)sqlite3_current_time + (double)43200) / (double)86400 + (double)2440587;
  }
#endif
  return 0;
}







|







 







|
>
>
>
>
>
>
>
>
>
>
>











<

|
<
>
|
|
|
|
|
<
<
<
<
<
<
<
<
<
<







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789

1790
1791

1792
1793
1794
1795
1796
1797










1798
1799
1800
1801
1802
1803
1804
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains code that is specific to windows.
**
** $Id: os_win.c,v 1.151 2009/03/30 12:42:45 drh Exp $
*/
#include "sqliteInt.h"
#if SQLITE_OS_WIN               /* This file is used for windows only */


/*
** A Note About Memory Allocation:
................................................................................
** return 0.  Return 1 if the time and date cannot be found.
*/
int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){
  FILETIME ft;
  /* FILETIME structure is a 64-bit value representing the number of 
     100-nanosecond intervals since January 1, 1601 (= JD 2305813.5). 
  */
  sqlite3_int64 timeW;   /* Whole days */
  sqlite3_int64 timeF;   /* Fractional Days */

  /* Number of 100-nanosecond intervals in a single day */
  static const sqlite3_int64 ntuPerDay = 
      10000000*(sqlite3_int64)86400;

  /* Number of 100-nanosecond intervals in half of a day */
  static const sqlite3_int64 ntuPerHalfDay = 
      10000000*(sqlite3_int64)43200;


#if SQLITE_OS_WINCE
  SYSTEMTIME time;
  GetSystemTime(&time);
  /* if SystemTimeToFileTime() fails, it returns zero. */
  if (!SystemTimeToFileTime(&time,&ft)){
    return 1;
  }
#else
  GetSystemTimeAsFileTime( &ft );
#endif
  UNUSED_PARAMETER(pVfs);

  timeW = (((sqlite3_int64)ft.dwHighDateTime)*4294967296) + ft.dwLowDateTime;
  timeF = timeW % ntuPerDay;          /* fractional days (100-nanoseconds) */

  timeW = timeW / ntuPerDay;          /* whole days */
  timeW = timeW + 2305813;            /* add whole days (from 2305813.5) */
  timeF = timeF + ntuPerHalfDay;      /* add half a day (from 2305813.5) */
  timeW = timeW + (timeF/ntuPerDay);  /* add whole day if half day made one */
  timeF = timeF % ntuPerDay;          /* compute new fractional days */
  *prNow = (double)timeW + ((double)timeF / (double)ntuPerDay);










#ifdef SQLITE_TEST
  if( sqlite3_current_time ){
    *prNow = ((double)sqlite3_current_time + (double)43200) / (double)86400 + (double)2440587;
  }
#endif
  return 0;
}