Skip to content

Commit 8facb7c

Browse files
committed
Uptime (Windows): improves comments
1 parent 92c65aa commit 8facb7c

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/common/windows/nt.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,9 @@ static inline uint64_t ffKSystemTimeToUInt64(const volatile KSYSTEM_TIME* pTime)
634634
{
635635
#if _WIN64
636636

637-
return *(uint64_t*) pTime;
637+
// This is safe even if pTime is not 8-byte aligned
638+
// See https://learn.microsoft.com/en-us/windows/win32/winprog64/fault-alignments
639+
return *(const volatile uint64_t*) pTime;
638640

639641
#else
640642

src/detection/uptime/uptime_windows.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
const char* ffDetectUptime(FFUptimeResult* result)
66
{
7-
// GetInterruptTime with Win7 support
7+
// QueryInterruptTime with Win7 support
88
uint64_t interruptTime = ffKSystemTimeToUInt64(&SharedUserData->InterruptTime);
99

1010
result->uptime = interruptTime / 10000; // Convert from 100-nanosecond intervals to milliseconds

0 commit comments

Comments
 (0)