Skip to content

Commit

Permalink
return _mktime() from timestamp()
Browse files Browse the repository at this point in the history
  • Loading branch information
FoamyGuy committed Jan 17, 2025
1 parent 1795aff commit c4b9a0b
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions adafruit_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -1520,18 +1520,10 @@ def toordinal(self) -> int:
return _ymd2ord(self._year, self._month, self._day)

def timestamp(self) -> 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 ``_mktime()``
to get an int version of the timestamp.
"""
"""Return POSIX timestamp as float."""
if not self._tzinfo is None:
return (self - _EPOCH).total_seconds()
s = self._mktime()
return s + self.microsecond / 1e6
return self._mktime()

def weekday(self) -> int:
"""Return the day of the week as an integer, where Monday is 0 and Sunday is 6."""
Expand Down

0 comments on commit c4b9a0b

Please sign in to comment.