We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Duration
1 parent 340f042 commit 5f347d7Copy full SHA for 5f347d7
src/libstd/time/duration.rs
@@ -265,6 +265,8 @@ impl Duration {
265
}
266
267
268
+// NOTE(stage0): Remove impl after a snapshot
269
+#[cfg(stage0)]
270
impl Neg<Duration> for Duration {
271
#[inline]
272
fn neg(&self) -> Duration {
@@ -276,6 +278,18 @@ impl Neg<Duration> for Duration {
276
278
277
279
280
281
+#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
282
+impl Neg<Duration> for Duration {
283
+ #[inline]
284
+ fn neg(self) -> Duration {
285
+ if self.nanos == 0 {
286
+ Duration { secs: -self.secs, nanos: 0 }
287
+ } else {
288
+ Duration { secs: -self.secs - 1, nanos: NANOS_PER_SEC - self.nanos }
289
+ }
290
291
+}
292
+
293
// NOTE(stage0): Remove impl after a snapshot
294
#[cfg(stage0)]
295
impl Add<Duration,Duration> for Duration {
0 commit comments