Mercurial > public > mercurial-scm > hg-stable
annotate mercurial/dirstateutils/timestamp.py @ 48481:c8ca21962ff4
dirstate: Document Timestamp.second_ambiguous
Differential Revision: https://phab.mercurial-scm.org/D11888
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Thu, 09 Dec 2021 10:23:41 +0100 |
parents | 000130cfafb6 |
children | 6000f5b25c9b |
rev | line source |
---|---|
48271
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
1 # Copyright Mercurial Contributors |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
2 # |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
3 # This software may be used and distributed according to the terms of the |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
4 # GNU General Public License version 2 or any later version. |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
5 |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
6 from __future__ import absolute_import |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
7 |
48273
68bb472aee9c
dirstate: ignore sub-second component when either is zero in mtime
Simon Sapin <simon.sapin@octobus.net>
parents:
48271
diff
changeset
|
8 import functools |
48427
08b060abd658
dirstate: move "get fs now" in the timestamp utility module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48274
diff
changeset
|
9 import os |
48271
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
10 import stat |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
11 |
48445
8d585aa9becf
dirstate: drop comparison primitive on the timestamp class
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48443
diff
changeset
|
12 from .. import error |
8d585aa9becf
dirstate: drop comparison primitive on the timestamp class
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48443
diff
changeset
|
13 |
48271
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
14 |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
15 rangemask = 0x7FFFFFFF |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
16 |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
17 |
48273
68bb472aee9c
dirstate: ignore sub-second component when either is zero in mtime
Simon Sapin <simon.sapin@octobus.net>
parents:
48271
diff
changeset
|
18 @functools.total_ordering |
48271
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
19 class timestamp(tuple): |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
20 """ |
48273
68bb472aee9c
dirstate: ignore sub-second component when either is zero in mtime
Simon Sapin <simon.sapin@octobus.net>
parents:
48271
diff
changeset
|
21 A Unix timestamp with optional nanoseconds precision, |
48271
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
22 modulo 2**31 seconds. |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
23 |
48481
c8ca21962ff4
dirstate: Document Timestamp.second_ambiguous
Simon Sapin <simon.sapin@octobus.net>
parents:
48468
diff
changeset
|
24 A 3-tuple containing: |
48271
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
25 |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
26 `truncated_seconds`: seconds since the Unix epoch, |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
27 truncated to its lower 31 bits |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
28 |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
29 `subsecond_nanoseconds`: number of nanoseconds since `truncated_seconds`. |
48273
68bb472aee9c
dirstate: ignore sub-second component when either is zero in mtime
Simon Sapin <simon.sapin@octobus.net>
parents:
48271
diff
changeset
|
30 When this is zero, the sub-second precision is considered unknown. |
48481
c8ca21962ff4
dirstate: Document Timestamp.second_ambiguous
Simon Sapin <simon.sapin@octobus.net>
parents:
48468
diff
changeset
|
31 |
c8ca21962ff4
dirstate: Document Timestamp.second_ambiguous
Simon Sapin <simon.sapin@octobus.net>
parents:
48468
diff
changeset
|
32 `second_ambiguous`: whether this timestamp is still "reliable" |
c8ca21962ff4
dirstate: Document Timestamp.second_ambiguous
Simon Sapin <simon.sapin@octobus.net>
parents:
48468
diff
changeset
|
33 (see `reliable_mtime_of`) if we drop its sub-second component. |
48271
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
34 """ |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
35 |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
36 def __new__(cls, value): |
48446
111098af6356
dirstate-item: add a "second_ambiguous` flag in the mtime tuple
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48445
diff
changeset
|
37 truncated_seconds, subsec_nanos, second_ambiguous = value |
111098af6356
dirstate-item: add a "second_ambiguous` flag in the mtime tuple
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48445
diff
changeset
|
38 value = (truncated_seconds & rangemask, subsec_nanos, second_ambiguous) |
48271
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
39 return super(timestamp, cls).__new__(cls, value) |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
40 |
48273
68bb472aee9c
dirstate: ignore sub-second component when either is zero in mtime
Simon Sapin <simon.sapin@octobus.net>
parents:
48271
diff
changeset
|
41 def __eq__(self, other): |
48445
8d585aa9becf
dirstate: drop comparison primitive on the timestamp class
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48443
diff
changeset
|
42 raise error.ProgrammingError( |
8d585aa9becf
dirstate: drop comparison primitive on the timestamp class
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48443
diff
changeset
|
43 'timestamp should never be compared directly' |
48273
68bb472aee9c
dirstate: ignore sub-second component when either is zero in mtime
Simon Sapin <simon.sapin@octobus.net>
parents:
48271
diff
changeset
|
44 ) |
68bb472aee9c
dirstate: ignore sub-second component when either is zero in mtime
Simon Sapin <simon.sapin@octobus.net>
parents:
48271
diff
changeset
|
45 |
68bb472aee9c
dirstate: ignore sub-second component when either is zero in mtime
Simon Sapin <simon.sapin@octobus.net>
parents:
48271
diff
changeset
|
46 def __gt__(self, other): |
48445
8d585aa9becf
dirstate: drop comparison primitive on the timestamp class
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48443
diff
changeset
|
47 raise error.ProgrammingError( |
8d585aa9becf
dirstate: drop comparison primitive on the timestamp class
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48443
diff
changeset
|
48 'timestamp should never be compared directly' |
8d585aa9becf
dirstate: drop comparison primitive on the timestamp class
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48443
diff
changeset
|
49 ) |
48273
68bb472aee9c
dirstate: ignore sub-second component when either is zero in mtime
Simon Sapin <simon.sapin@octobus.net>
parents:
48271
diff
changeset
|
50 |
48271
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
51 |
48427
08b060abd658
dirstate: move "get fs now" in the timestamp utility module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48274
diff
changeset
|
52 def get_fs_now(vfs): |
08b060abd658
dirstate: move "get fs now" in the timestamp utility module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48274
diff
changeset
|
53 """return a timestamp for "now" in the current vfs |
08b060abd658
dirstate: move "get fs now" in the timestamp utility module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48274
diff
changeset
|
54 |
08b060abd658
dirstate: move "get fs now" in the timestamp utility module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48274
diff
changeset
|
55 This will raise an exception if no temporary files could be created. |
08b060abd658
dirstate: move "get fs now" in the timestamp utility module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48274
diff
changeset
|
56 """ |
08b060abd658
dirstate: move "get fs now" in the timestamp utility module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48274
diff
changeset
|
57 tmpfd, tmpname = vfs.mkstemp() |
08b060abd658
dirstate: move "get fs now" in the timestamp utility module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48274
diff
changeset
|
58 try: |
08b060abd658
dirstate: move "get fs now" in the timestamp utility module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48274
diff
changeset
|
59 return mtime_of(os.fstat(tmpfd)) |
08b060abd658
dirstate: move "get fs now" in the timestamp utility module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48274
diff
changeset
|
60 finally: |
08b060abd658
dirstate: move "get fs now" in the timestamp utility module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48274
diff
changeset
|
61 os.close(tmpfd) |
08b060abd658
dirstate: move "get fs now" in the timestamp utility module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48274
diff
changeset
|
62 vfs.unlink(tmpname) |
08b060abd658
dirstate: move "get fs now" in the timestamp utility module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48274
diff
changeset
|
63 |
08b060abd658
dirstate: move "get fs now" in the timestamp utility module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48274
diff
changeset
|
64 |
48271
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
65 def zero(): |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
66 """ |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
67 Returns the `timestamp` at the Unix epoch. |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
68 """ |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
69 return tuple.__new__(timestamp, (0, 0)) |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
70 |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
71 |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
72 def mtime_of(stat_result): |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
73 """ |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
74 Takes an `os.stat_result`-like object and returns a `timestamp` object |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
75 for its modification time. |
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
76 """ |
48274
83d0bd45b662
dirstate-v2: actually use sub-second mtime precision
Simon Sapin <simon.sapin@octobus.net>
parents:
48273
diff
changeset
|
77 try: |
83d0bd45b662
dirstate-v2: actually use sub-second mtime precision
Simon Sapin <simon.sapin@octobus.net>
parents:
48273
diff
changeset
|
78 # TODO: add this attribute to `osutil.stat` objects, |
83d0bd45b662
dirstate-v2: actually use sub-second mtime precision
Simon Sapin <simon.sapin@octobus.net>
parents:
48273
diff
changeset
|
79 # see `mercurial/cext/osutil.c`. |
83d0bd45b662
dirstate-v2: actually use sub-second mtime precision
Simon Sapin <simon.sapin@octobus.net>
parents:
48273
diff
changeset
|
80 # |
83d0bd45b662
dirstate-v2: actually use sub-second mtime precision
Simon Sapin <simon.sapin@octobus.net>
parents:
48273
diff
changeset
|
81 # This attribute is also not available on Python 2. |
83d0bd45b662
dirstate-v2: actually use sub-second mtime precision
Simon Sapin <simon.sapin@octobus.net>
parents:
48273
diff
changeset
|
82 nanos = stat_result.st_mtime_ns |
83d0bd45b662
dirstate-v2: actually use sub-second mtime precision
Simon Sapin <simon.sapin@octobus.net>
parents:
48273
diff
changeset
|
83 except AttributeError: |
83d0bd45b662
dirstate-v2: actually use sub-second mtime precision
Simon Sapin <simon.sapin@octobus.net>
parents:
48273
diff
changeset
|
84 # https://docs.python.org/2/library/os.html#os.stat_float_times |
83d0bd45b662
dirstate-v2: actually use sub-second mtime precision
Simon Sapin <simon.sapin@octobus.net>
parents:
48273
diff
changeset
|
85 # "For compatibility with older Python versions, |
83d0bd45b662
dirstate-v2: actually use sub-second mtime precision
Simon Sapin <simon.sapin@octobus.net>
parents:
48273
diff
changeset
|
86 # accessing stat_result as a tuple always returns integers." |
83d0bd45b662
dirstate-v2: actually use sub-second mtime precision
Simon Sapin <simon.sapin@octobus.net>
parents:
48273
diff
changeset
|
87 secs = stat_result[stat.ST_MTIME] |
48271
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
88 |
48274
83d0bd45b662
dirstate-v2: actually use sub-second mtime precision
Simon Sapin <simon.sapin@octobus.net>
parents:
48273
diff
changeset
|
89 subsec_nanos = 0 |
83d0bd45b662
dirstate-v2: actually use sub-second mtime precision
Simon Sapin <simon.sapin@octobus.net>
parents:
48273
diff
changeset
|
90 else: |
83d0bd45b662
dirstate-v2: actually use sub-second mtime precision
Simon Sapin <simon.sapin@octobus.net>
parents:
48273
diff
changeset
|
91 billion = int(1e9) |
83d0bd45b662
dirstate-v2: actually use sub-second mtime precision
Simon Sapin <simon.sapin@octobus.net>
parents:
48273
diff
changeset
|
92 secs = nanos // billion |
83d0bd45b662
dirstate-v2: actually use sub-second mtime precision
Simon Sapin <simon.sapin@octobus.net>
parents:
48273
diff
changeset
|
93 subsec_nanos = nanos % billion |
48271
269ff8978086
dirstate: store mtimes with nanosecond precision in memory
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
94 |
48446
111098af6356
dirstate-item: add a "second_ambiguous` flag in the mtime tuple
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48445
diff
changeset
|
95 return timestamp((secs, subsec_nanos, False)) |
48443
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
96 |
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
97 |
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
98 def reliable_mtime_of(stat_result, present_mtime): |
48481
c8ca21962ff4
dirstate: Document Timestamp.second_ambiguous
Simon Sapin <simon.sapin@octobus.net>
parents:
48468
diff
changeset
|
99 """Same as `mtime_of`, but return `None` or a `Timestamp` with |
c8ca21962ff4
dirstate: Document Timestamp.second_ambiguous
Simon Sapin <simon.sapin@octobus.net>
parents:
48468
diff
changeset
|
100 `second_ambiguous` set if the date might be ambiguous. |
48443
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
101 |
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
102 A modification time is reliable if it is older than "present_time" (or |
48468
000130cfafb6
rhg: Update the dirstate on disk after status
Simon Sapin <simon.sapin@octobus.net>
parents:
48451
diff
changeset
|
103 sufficiently in the future). |
48443
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
104 |
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
105 Otherwise a concurrent modification might happens with the same mtime. |
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
106 """ |
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
107 file_mtime = mtime_of(stat_result) |
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
108 file_second = file_mtime[0] |
48451
ca42667c8d26
status: keep second-ambiguous mtimes during fixup
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48446
diff
changeset
|
109 file_ns = file_mtime[1] |
48443
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
110 boundary_second = present_mtime[0] |
48451
ca42667c8d26
status: keep second-ambiguous mtimes during fixup
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48446
diff
changeset
|
111 boundary_ns = present_mtime[1] |
48443
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
112 # If the mtime of the ambiguous file is younger (or equal) to the starting |
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
113 # point of the `status` walk, we cannot garantee that another, racy, write |
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
114 # will not happen right after with the same mtime and we cannot cache the |
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
115 # information. |
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
116 # |
48451
ca42667c8d26
status: keep second-ambiguous mtimes during fixup
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48446
diff
changeset
|
117 # However if the mtime is far away in the future, this is likely some |
48443
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
118 # mismatch between the current clock and previous file system operation. So |
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
119 # mtime more than one days in the future are considered fine. |
48451
ca42667c8d26
status: keep second-ambiguous mtimes during fixup
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48446
diff
changeset
|
120 if boundary_second == file_second: |
ca42667c8d26
status: keep second-ambiguous mtimes during fixup
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48446
diff
changeset
|
121 if file_ns and boundary_ns: |
ca42667c8d26
status: keep second-ambiguous mtimes during fixup
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48446
diff
changeset
|
122 if file_ns < boundary_ns: |
ca42667c8d26
status: keep second-ambiguous mtimes during fixup
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48446
diff
changeset
|
123 return timestamp((file_second, file_ns, True)) |
ca42667c8d26
status: keep second-ambiguous mtimes during fixup
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48446
diff
changeset
|
124 return None |
ca42667c8d26
status: keep second-ambiguous mtimes during fixup
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48446
diff
changeset
|
125 elif boundary_second < file_second < (3600 * 24 + boundary_second): |
48443
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
126 return None |
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
127 else: |
9ae0353c9f5d
status: move the boundary comparison logic within the timestamp module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48427
diff
changeset
|
128 return file_mtime |