From a74a9744f1713ef98a8e6006976d1533906f4d20 Mon Sep 17 00:00:00 2001 From: Brandon W Maister Date: Sat, 16 Nov 2019 16:19:08 -0500 Subject: [PATCH] Remove num_days_from_epoch Deciding between zero-indexed (slightly more reasonable, more compatible with the outside world) and one-indexed (same indexing as `num_days_from_ce`) seems not worth it. It's trivial to build `num_days_from_epoch` based on the docs in `num_days_from_ce`, which punts on the decision and is therefor probably the right decision. --- src/lib.rs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 31f7a77..9d583fd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -915,21 +915,6 @@ pub trait Datelike: Sized { ndays += ((year * 1461) >> 2) - div_100 + (div_100 >> 2); ndays + self.ordinal() as i32 } - - /// Return the number of days since the unix epoch, 1970-01-01 - /// - /// # Example: - /// - /// ``` - /// use chrono::{NaiveDate, Datelike}; - /// - /// assert_eq!(NaiveDate::from_ymd(1970, 1, 1).num_days_from_epoch(), 0); - /// assert_eq!(NaiveDate::from_ymd(1969, 1, 1).num_days_from_epoch(), -365); - /// assert_eq!(NaiveDate::from_ymd(1999, 12, 31).num_days_from_epoch(), 10_956); - /// ``` - fn num_days_from_epoch(&self) -> i32 { - self.num_days_from_ce() - EPOCH_NUM_DAYS_FROM_CE - } } /// The common set of methods for time component.