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

Timestamps created in EventBuilder are incorrect #92

Open
watsonjj opened this issue Jan 22, 2020 · 1 comment
Open

Timestamps created in EventBuilder are incorrect #92

watsonjj opened this issue Jan 22, 2020 · 1 comment

Comments

@watsonjj
Copy link

watsonjj commented Jan 22, 2020

cpu_time = datetime.utcnow()

cpu_time_s = int(r_cpu_time.timestamp())

Using datetime.datetime.utcnow().timestamp() results in an incorrect unix time if your timezone is not UTC.

See https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow and https://bugs.python.org/issue33293.

Correct approach to get seconds from epoch (UTC/unix) using the datetime package is datetime.datetime.now(datetime.timezone.utc).timestamp().

Existing SS data therefore contain a timestamp that if you assume is unix time, is two hours earlier than the true unix time.

@watsonjj
Copy link
Author

Analysis up to this point has correctly accounted for this. But this has the potential to be very confusing in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant