From 932202fb5ad8f083e0a9aa087ccf56de0f50c963 Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Thu, 29 Feb 2024 21:23:57 +0100 Subject: [PATCH] Add comment to calculate `UNIX_EPOCH_DAY` --- src/datetime/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/datetime/mod.rs b/src/datetime/mod.rs index 5813ae831d..5bb7fdecef 100644 --- a/src/datetime/mod.rs +++ b/src/datetime/mod.rs @@ -1881,6 +1881,14 @@ where } } +/// Number of days between Januari 1, 1970 and December 31, 1 BCE which define to be day 0. +/// 4 full leap year cycles until December 31, 1600 4 * 146097 = 584388 +/// 1 day until January 1, 1601 1 +/// 369 years until Januari 1, 1970 369 * 365 = 134685 +/// of which floor(369 / 4) are leap years floor(369 / 4) = 92 +/// except for 1700, 1800 and 1900 -3 + +/// -------- +/// 719163 const UNIX_EPOCH_DAY: i64 = 719_163; #[cfg(all(test, any(feature = "rustc-serialize", feature = "serde")))]