/ Check-in [2fe3a843]
Login

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

Overview
Comment:Make win32GetTimeOfDay() in the lsm1 test code more portable.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:2fe3a84330063378ca9fc5bfc8efe486c52d50b5c40be4f402a4f2318be69436
User & Date: mistachkin 2017-07-11 17:54:27
Context
2017-07-11
18:11
Fix harmless compiler warnings in the core. check-in: 55e93f25 user: drh tags: trunk
17:54
Make win32GetTimeOfDay() in the lsm1 test code more portable. check-in: 2fe3a843 user: mistachkin tags: trunk
17:28
Enabled the new sqlite3_prepare_v3() and sqlite3_prepare16_v3() interfaces for loadable extensions. check-in: b9debd62 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/lsm1/lsm-test/lsmtest_win32.c.

     8      8   #define TICKS_UNIX_EPOCH      (116444736000000000LL)
     9      9   
    10     10   int win32GetTimeOfDay(
    11     11     struct timeval *tp,
    12     12     void *tzp
    13     13   ){
    14     14     FILETIME fileTime;
    15         -  ULARGE_INTEGER largeInteger;
    16     15     ULONGLONG ticks;
           16  +  ULONGLONG unixTicks;
    17     17   
    18     18     unused_parameter(tzp);
    19     19     memset(&fileTime, 0, sizeof(FILETIME));
    20     20     GetSystemTimeAsFileTime(&fileTime);
    21         -  memset(&largeInteger, 0, sizeof(ULARGE_INTEGER));
    22         -  largeInteger.LowPart = fileTime.dwLowDateTime;
    23         -  largeInteger.HighPart = fileTime.dwHighDateTime;
    24         -  ticks = largeInteger.QuadPart - TICKS_UNIX_EPOCH;
    25         -  tp->tv_sec = (long)(ticks / TICKS_PER_SECOND);
    26         -  ticks -= ((ULONGLONG)tp->tv_sec * TICKS_PER_SECOND);
    27         -  tp->tv_usec = (long)(ticks / TICKS_PER_MICROSECOND);
           21  +  ticks = (ULONGLONG)fileTime.dwHighDateTime << 32;
           22  +  ticks |= (ULONGLONG)fileTime.dwLowDateTime;
           23  +  unixTicks = ticks - TICKS_UNIX_EPOCH;
           24  +  tp->tv_sec = (long)(unixTicks / TICKS_PER_SECOND);
           25  +  unixTicks -= ((ULONGLONG)tp->tv_sec * TICKS_PER_SECOND);
           26  +  tp->tv_usec = (long)(unixTicks / TICKS_PER_MICROSECOND);
           27  +
    28     28     return 0;
    29     29   }
    30     30   #endif