Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: timestamp resolution to microseconds on Windows #1039

Merged
merged 3 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

**Fixes**:

- Correct the timestamp resolution to microseconds on Windows. ([#1039](https://github.com/getsentry/sentry-native/pull/1039))

## 0.7.9

**Fixes**:
Expand Down
8 changes: 5 additions & 3 deletions src/sentry_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ sentry__usec_time(void)
// Contains a 64-bit value representing the number of 100-nanosecond
// intervals since January 1, 1601 (UTC).
FILETIME file_time;
SYSTEMTIME system_time;
GetSystemTime(&system_time);
SystemTimeToFileTime(&system_time, &file_time);
# if _WIN32_WINNT >= 0x0602
GetSystemTimePreciseAsFileTime(&file_time);
# else
GetSystemTimeAsFileTime(&file_time);
# endif

uint64_t timestamp = (uint64_t)file_time.dwLowDateTime
+ ((uint64_t)file_time.dwHighDateTime << 32);
Expand Down
Loading