(self)
| 1979 | return cls(seconds, us * 1000) |
| 1980 | |
| 1981 | def to_datetime(self) -> datetime: |
| 1982 | # datetime.fromtimestamp() expects a timestamp in seconds, not microseconds |
| 1983 | # if we pass it as a floating point number, we will run into rounding errors |
| 1984 | # see also #407 |
| 1985 | offset = timedelta(seconds=self.seconds, microseconds=self.nanos // 1000) |
| 1986 | return DATETIME_ZERO + offset |
| 1987 | |
| 1988 | @staticmethod |
| 1989 | def timestamp_to_json(dt: datetime) -> str: |
no outgoing calls