From 68cccc840bd9f58b8eb680185f214b280be20a43 Mon Sep 17 00:00:00 2001 From: Nathan Fisher Date: Mon, 26 Jun 2023 12:47:55 -0400 Subject: [PATCH] Fix error introduced in previous commit, where days in month was not being updated while creating a DateTime struct from a u64 timestamp --- src/time/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/time/mod.rs b/src/time/mod.rs index fdcf30e..c32c045 100644 --- a/src/time/mod.rs +++ b/src/time/mod.rs @@ -172,10 +172,12 @@ impl From for DateTime { } } let mut month = 1; - let m_days = u64::from(days_in_month(month, year)); + let mut m_days = u64::from(days_in_month(month, year)); while m_days <= days { + println!("Days in month {month}: {m_days}"); days -= m_days; month += 1; + m_days = u64::from(days_in_month(month, year)); } let seconds = ts % SECS_PER_DAY; let minutes = seconds / 60;