Skip to content

Timestamps created in EventBuilder are incorrect #92

@watsonjj

Description

@watsonjj

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions