Show More
@@ -9,6 +9,8 b' import functools' | |||
|
9 | 9 | import os |
|
10 | 10 | import stat |
|
11 | 11 | |
|
12 | from .. import error | |
|
13 | ||
|
12 | 14 | |
|
13 | 15 | rangemask = 0x7FFFFFFF |
|
14 | 16 | |
@@ -34,25 +36,14 b' class timestamp(tuple):' | |||
|
34 | 36 | return super(timestamp, cls).__new__(cls, value) |
|
35 | 37 | |
|
36 | 38 | def __eq__(self, other): |
|
37 | self_secs, self_subsec_nanos = self | |
|
38 | other_secs, other_subsec_nanos = other | |
|
39 | return self_secs == other_secs and ( | |
|
40 | self_subsec_nanos == other_subsec_nanos | |
|
41 | or self_subsec_nanos == 0 | |
|
42 | or other_subsec_nanos == 0 | |
|
39 | raise error.ProgrammingError( | |
|
40 | 'timestamp should never be compared directly' | |
|
43 | 41 | ) |
|
44 | 42 | |
|
45 | 43 | def __gt__(self, other): |
|
46 | self_secs, self_subsec_nanos = self | |
|
47 | other_secs, other_subsec_nanos = other | |
|
48 | if self_secs > other_secs: | |
|
49 | return True | |
|
50 | if self_secs < other_secs: | |
|
51 | return False | |
|
52 | if self_subsec_nanos == 0 or other_subsec_nanos == 0: | |
|
53 | # they are considered equal, so not "greater than" | |
|
54 | return False | |
|
55 | return self_subsec_nanos > other_subsec_nanos | |
|
44 | raise error.ProgrammingError( | |
|
45 | 'timestamp should never be compared directly' | |
|
46 | ) | |
|
56 | 47 | |
|
57 | 48 | |
|
58 | 49 | def get_fs_now(vfs): |
General Comments 0
You need to be logged in to leave comments.
Login now