crabmail

Static HTML email archive viewer in Rust
git clone git://git.alexwennerberg.com/crabmail
Log | Files | Refs | README | LICENSE

commit e66cde1173e26370884d28f813bf988fbe11d26f
parent 1e6f63062f996551b379807d287059aeacf6c372
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Thu, 23 Dec 2021 09:01:32 -0800

cleanup time

Diffstat:
Msrc/time.rs | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/time.rs b/src/time.rs @@ -51,29 +51,29 @@ pub fn secs_to_date(unixtime: u64) -> Date { days -= 1; } let mut wday = (3 + days) % 7; - if (wday < 0) { + if wday < 0 { wday += 7 }; let mut qc_cycles = days / DAYS_PER_400Y; let mut remdays = days % DAYS_PER_400Y; - if (remdays < 0) { + if remdays < 0 { remdays += DAYS_PER_400Y; qc_cycles -= 1; } let mut c_cycles = remdays / DAYS_PER_100Y; - if (c_cycles == 4) { + if c_cycles == 4 { c_cycles -= 1; } remdays -= c_cycles * DAYS_PER_100Y; let mut q_cycles = remdays / DAYS_PER_4Y; - if (q_cycles == 25) { + if q_cycles == 25 { q_cycles -= 1 } remdays -= q_cycles * DAYS_PER_4Y; let mut remyears = remdays / 365; - if (remyears == 4) { + if remyears == 4 { remyears -= 1 } remdays -= remyears * 365; @@ -84,7 +84,7 @@ pub fn secs_to_date(unixtime: u64) -> Date { false => 0, }; let mut yday = remdays + 31 + 28 + leap; - if (yday >= 365 + leap) { + if yday >= 365 + leap { yday -= 365 + leap }