equal
deleted
inserted
replaced
128 /// Some APIs simply return zero when more precision is not available. |
128 /// Some APIs simply return zero when more precision is not available. |
129 /// When comparing values from different sources, if only one is truncated |
129 /// When comparing values from different sources, if only one is truncated |
130 /// in that way, doing a simple comparison would cause many false |
130 /// in that way, doing a simple comparison would cause many false |
131 /// negatives. |
131 /// negatives. |
132 pub fn likely_equal(self, other: Self) -> bool { |
132 pub fn likely_equal(self, other: Self) -> bool { |
133 self.truncated_seconds == other.truncated_seconds |
133 if self.truncated_seconds != other.truncated_seconds { |
134 && (self.nanoseconds == other.nanoseconds |
134 false |
135 || self.nanoseconds == 0 |
135 } else if self.nanoseconds == 0 || other.nanoseconds == 0 { |
136 || other.nanoseconds == 0) |
136 if self.second_ambiguous { |
|
137 false |
|
138 } else { |
|
139 true |
|
140 } |
|
141 } else { |
|
142 self.nanoseconds == other.nanoseconds |
|
143 } |
137 } |
144 } |
138 |
145 |
139 pub fn likely_equal_to_mtime_of( |
146 pub fn likely_equal_to_mtime_of( |
140 self, |
147 self, |
141 metadata: &fs::Metadata, |
148 metadata: &fs::Metadata, |