From dc0db358abe19481e475e10c32149b53370f1a1c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:57:31 +0200 Subject: Merging upstream version 1.72.1+dfsg1. Signed-off-by: Daniel Baumann --- vendor/chrono/src/offset/utc.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'vendor/chrono/src/offset/utc.rs') diff --git a/vendor/chrono/src/offset/utc.rs b/vendor/chrono/src/offset/utc.rs index cfed754b2..dbcb8eecb 100644 --- a/vendor/chrono/src/offset/utc.rs +++ b/vendor/chrono/src/offset/utc.rs @@ -35,9 +35,9 @@ use crate::{Date, DateTime}; /// ``` /// use chrono::{DateTime, TimeZone, NaiveDateTime, Utc}; /// -/// let dt = DateTime::::from_utc(NaiveDateTime::from_timestamp(61, 0), Utc); +/// let dt = DateTime::::from_utc(NaiveDateTime::from_timestamp_opt(61, 0).unwrap(), Utc); /// -/// assert_eq!(Utc.timestamp(61, 0), dt); +/// assert_eq!(Utc.timestamp_opt(61, 0).unwrap(), dt); /// assert_eq!(Utc.with_ymd_and_hms(1970, 1, 1, 0, 1, 1).unwrap(), dt); /// ``` #[derive(Copy, Clone, PartialEq, Eq, Hash)] @@ -54,6 +54,7 @@ impl Utc { note = "use `Utc::now()` instead, potentially with `.date_naive()`" )] #[allow(deprecated)] + #[must_use] pub fn today() -> Date { Utc::now().date() } @@ -64,6 +65,7 @@ impl Utc { feature = "wasmbind", not(any(target_os = "emscripten", target_os = "wasi")) )))] + #[must_use] pub fn now() -> DateTime { let now = SystemTime::now().duration_since(UNIX_EPOCH).expect("system time before Unix epoch"); @@ -78,6 +80,7 @@ impl Utc { feature = "wasmbind", not(any(target_os = "emscripten", target_os = "wasi")) ))] + #[must_use] pub fn now() -> DateTime { let now = js_sys::Date::new_0(); DateTime::::from(now) -- cgit v1.2.3