-
Notifications
You must be signed in to change notification settings - Fork 6
datetime time offset converting datetime-to-timestamp-back-to-datetime #29
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
Comments
@schaefer01 I moved this to the datetime library as the potential issue is with it rather than the bundle at large. Can you post the contents of the |
[ |
This because >>> from adafruit_datetime import datetime as dt
>>> tt = dt.fromtimestamp(1736958434)
>>> tt
datetime.datetime(2025, 1, 15, 16, 27, 14)
>>> tt.timestamp()
1.73696e+09
>>> f"{tt.timestamp():f}"
'1736958464.000000' This matches the float value of >>> f"{1736958434.0:f}"
'1736958464.000000' |
Agree'd with Neradoc. This is essentially the same issue reported in #24 As a workaround you can use
|
We should mention it in the docs. |
You get the timestamp from a datetime object. In your code above, dtobj._mktime() |
note: _mktime() takes the datetime object as its parameter, i.e. ts = dt._mktime(dtobj) |
This works now, I'll close unless someone want to add more |
Ah sorry about that, I mixed up variable names with module imports in your code. I do think this can be closed. I'll add a note to the timestamp() documentation about it. |
hi,
I'm using this: adafruit-circuitpython-bundle-9.x-mpy-20240625 and get a minutes and seconds offset with my conversion
Is this a me problem or a you problem?
thank you for your consideration
bob s.
The text was updated successfully, but these errors were encountered: