Skip to content
Merged
Changes from 2 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
9 changes: 8 additions & 1 deletion adafruit_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -1520,7 +1520,14 @@ def toordinal(self) -> int:
return _ymd2ord(self._year, self._month, self._day)

def timestamp(self) -> float:
"Return POSIX timestamp as float"
"""Return POSIX timestamp as float.

Note that Floats on most boards are encoded in 30 bits
internally, with effectively 22 bits of precision. As a result,
for modern dates this value can be off by several minutes.
As a workaround you can access the function ``_mitime()``
to get an int version of the timestamp.
"""
if not self._tzinfo is None:
return (self - _EPOCH).total_seconds()
s = self._mktime()
Expand Down
Loading