From a5be5cc59232dcbf306fe922cc01e764740d5d06 Mon Sep 17 00:00:00 2001 From: "Sergey V. Galtsev" Date: Sun, 31 Jul 2016 00:42:11 +0300 Subject: [PATCH] Fix spilling of exceeding `tm_sec` into `tm_nsec` in `tm_to_datetime()`. --- src/offset/local.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/offset/local.rs b/src/offset/local.rs index 5d7a16a..10fff19 100644 --- a/src/offset/local.rs +++ b/src/offset/local.rs @@ -22,8 +22,8 @@ use super::fixed::FixedOffset; /// This assumes that `time` is working correctly, i.e. any error is fatal. fn tm_to_datetime(mut tm: stdtime::Tm) -> DateTime { if tm.tm_sec >= 60 { - tm.tm_sec = 59; tm.tm_nsec += (tm.tm_sec - 59) * 1_000_000_000; + tm.tm_sec = 59; } // from_yo is more efficient than from_ymd (since it's the internal representation).