Skip to content

Commit 4144f42

Browse files
committed
revert(windows): utils.c
1 parent b6be2c3 commit 4144f42

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/utils.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -369,25 +369,15 @@ int ai_uuid_v7_generate (uint8_t value[UUID_LEN]) {
369369
#endif
370370

371371
// get current timestamp in ms
372-
uint64_t timestamp;
373-
#if defined(_WIN32)
374-
// Use GetSystemTimeAsFileTime for Windows/MinGW
375-
FILETIME ft;
376-
GetSystemTimeAsFileTime(&ft);
377-
uint64_t t = ((uint64_t)ft.dwHighDateTime << 32) | ft.dwLowDateTime;
378-
// Convert FILETIME (100-ns intervals since Jan 1, 1601) to ms since Unix epoch
379-
timestamp = (t / 10000ULL) - 11644473600000ULL;
380-
#else
381372
struct timespec ts;
382-
#if defined(__ANDROID__)
373+
#ifdef __ANDROID__
383374
if (clock_gettime(CLOCK_REALTIME, &ts) != 0) return -1;
384375
#else
385376
if (timespec_get(&ts, TIME_UTC) == 0) return -1;
386377
#endif
387-
timestamp = (uint64_t)ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
388-
#endif
389378

390379
// add timestamp part to UUID
380+
uint64_t timestamp = (uint64_t)ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
391381
value[0] = (timestamp >> 40) & 0xFF;
392382
value[1] = (timestamp >> 32) & 0xFF;
393383
value[2] = (timestamp >> 24) & 0xFF;
@@ -536,4 +526,4 @@ bool parse_keyvalue_string (const char *str, keyvalue_callback callback, void *x
536526
}
537527

538528
return true;
539-
}
529+
}

0 commit comments

Comments
 (0)