|
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.
SSDAQ/ssdaq/receivers/readout_assembler.py
Line 31 in 7c70571
SSDAQ/ssdaq/receivers/readout_assembler.py
Line 255 in 7c70571
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.