summaryrefslogtreecommitdiffstats
path: root/vendor/chrono/src/offset/utc.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/chrono/src/offset/utc.rs
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/chrono/src/offset/utc.rs')
-rw-r--r--vendor/chrono/src/offset/utc.rs7
1 files changed, 5 insertions, 2 deletions
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::<Utc>::from_utc(NaiveDateTime::from_timestamp(61, 0), Utc);
+/// let dt = DateTime::<Utc>::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> {
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<Utc> {
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<Utc> {
let now = js_sys::Date::new_0();
DateTime::<Utc>::from(now)