Create a Timestamp from posix timestamp in seconds. :param unix_float: Posix timestamp in seconds. :type unix_float: int or float
(unix_sec)
| 117 | |
| 118 | @staticmethod |
| 119 | def from_unix(unix_sec): |
| 120 | """Create a Timestamp from posix timestamp in seconds. |
| 121 | |
| 122 | :param unix_float: Posix timestamp in seconds. |
| 123 | :type unix_float: int or float |
| 124 | """ |
| 125 | seconds = int(unix_sec // 1) |
| 126 | nanoseconds = int((unix_sec % 1) * 10**9) |
| 127 | return Timestamp(seconds, nanoseconds) |
| 128 | |
| 129 | def to_unix(self): |
| 130 | """Get the timestamp as a floating-point value. |