/ 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 Unified Diffs Ignore Whitespace Patch

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

8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27

28
29
30
#define TICKS_UNIX_EPOCH      (116444736000000000LL)

int win32GetTimeOfDay(
  struct timeval *tp,
  void *tzp
){
  FILETIME fileTime;
  ULARGE_INTEGER largeInteger;
  ULONGLONG ticks;


  unused_parameter(tzp);
  memset(&fileTime, 0, sizeof(FILETIME));
  GetSystemTimeAsFileTime(&fileTime);
  memset(&largeInteger, 0, sizeof(ULARGE_INTEGER));
  largeInteger.LowPart = fileTime.dwLowDateTime;
  largeInteger.HighPart = fileTime.dwHighDateTime;
  ticks = largeInteger.QuadPart - TICKS_UNIX_EPOCH;
  tp->tv_sec = (long)(ticks / TICKS_PER_SECOND);
  ticks -= ((ULONGLONG)tp->tv_sec * TICKS_PER_SECOND);
  tp->tv_usec = (long)(ticks / TICKS_PER_MICROSECOND);

  return 0;
}
#endif







<

>




|
|
<
|
|
|
|
>



8
9
10
11
12
13
14

15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
#define TICKS_UNIX_EPOCH      (116444736000000000LL)

int win32GetTimeOfDay(
  struct timeval *tp,
  void *tzp
){
  FILETIME fileTime;

  ULONGLONG ticks;
  ULONGLONG unixTicks;

  unused_parameter(tzp);
  memset(&fileTime, 0, sizeof(FILETIME));
  GetSystemTimeAsFileTime(&fileTime);
  ticks = (ULONGLONG)fileTime.dwHighDateTime << 32;
  ticks |= (ULONGLONG)fileTime.dwLowDateTime;

  unixTicks = ticks - TICKS_UNIX_EPOCH;
  tp->tv_sec = (long)(unixTicks / TICKS_PER_SECOND);
  unixTicks -= ((ULONGLONG)tp->tv_sec * TICKS_PER_SECOND);
  tp->tv_usec = (long)(unixTicks / TICKS_PER_MICROSECOND);

  return 0;
}
#endif