From 0853499bece2c2890b7287cf5fade77ba68495c7 Mon Sep 17 00:00:00 2001 From: Kosta Welke Date: Mon, 4 Sep 2017 15:04:07 +0200 Subject: [PATCH] Add doc comment to lib.rs: Conversion from and to EPOCH timestamps --- src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index d519b2d..6a66e24 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -288,6 +288,17 @@ //! assert!(Utc.datetime_from_str("Sat Nov 28 12:00:09 2014", "%a %b %e %T %Y").is_err()); //! ``` //! +//! ### Conversion from and to EPOCH timestamps +//! +//! Use [`Utc.timestamp(seconds, nanoseconds)`](./offset/trait.TimeZone.html#method.timestamp) +//! to construct a [`DateTime`](./struct.DateTime.html) from a UNIX timestamp +//! (seconds, nanoseconds that passed since January 1st 1970). +//! +//! Use [`DateTime.timestamp`](./struct.DateTime.html#method.timestamp) to get the timestamp (in seconds) +//! from a [`DateTime`](./struct.DateTime.html). Additionally, you can use +//! [`DateTime.timestamp_subsec_nanos`](./struct.DateTime.html#method.timestamp_subsec_nanos) +//! to get the number of additional number of nanoseconds. +//! //! ### Individual date //! //! Chrono also provides an individual date type ([**`Date`**](./struct.Date.html)).