equal
deleted
inserted
replaced
29 `subsecond_nanoseconds`: number of nanoseconds since `truncated_seconds`. |
29 `subsecond_nanoseconds`: number of nanoseconds since `truncated_seconds`. |
30 When this is zero, the sub-second precision is considered unknown. |
30 When this is zero, the sub-second precision is considered unknown. |
31 """ |
31 """ |
32 |
32 |
33 def __new__(cls, value): |
33 def __new__(cls, value): |
34 truncated_seconds, subsec_nanos = value |
34 truncated_seconds, subsec_nanos, second_ambiguous = value |
35 value = (truncated_seconds & rangemask, subsec_nanos) |
35 value = (truncated_seconds & rangemask, subsec_nanos, second_ambiguous) |
36 return super(timestamp, cls).__new__(cls, value) |
36 return super(timestamp, cls).__new__(cls, value) |
37 |
37 |
38 def __eq__(self, other): |
38 def __eq__(self, other): |
39 raise error.ProgrammingError( |
39 raise error.ProgrammingError( |
40 'timestamp should never be compared directly' |
40 'timestamp should never be compared directly' |
87 else: |
87 else: |
88 billion = int(1e9) |
88 billion = int(1e9) |
89 secs = nanos // billion |
89 secs = nanos // billion |
90 subsec_nanos = nanos % billion |
90 subsec_nanos = nanos % billion |
91 |
91 |
92 return timestamp((secs, subsec_nanos)) |
92 return timestamp((secs, subsec_nanos, False)) |
93 |
93 |
94 |
94 |
95 def reliable_mtime_of(stat_result, present_mtime): |
95 def reliable_mtime_of(stat_result, present_mtime): |
96 """same as `mtime_of`, but return None if the date might be ambiguous |
96 """same as `mtime_of`, but return None if the date might be ambiguous |
97 |
97 |