about summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-02-04 18:42:14 +0100
committerGitHub <noreply@github.com>2022-02-04 18:42:14 +0100
commitaf2886eef9cb27419ea7d8a451a1fc1cb33d5d8e (patch)
tree63cd3e1871a28c49397cc756d212f9608759a608 /library/std/src/sys
parent6f03bd09ff6ef6402b68b32485f0d25e7f6c0c01 (diff)
parent175219ad0c7f75a055c167c4cca02d748ab64f31 (diff)
downloadrust-af2886eef9cb27419ea7d8a451a1fc1cb33d5d8e.tar.gz
rust-af2886eef9cb27419ea7d8a451a1fc1cb33d5d8e.zip
Rollup merge of #93495 - solid-rs:fix-kmc-solid-rtc-month, r=yaahc
kmc-solid: Fix off-by-one error in `SystemTime::now`

Fixes a miscalculation of `SystemTime`  on the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets.

Unlike the identically-named libc counterpart `tm::tm_mon`, `SOLID_RTC_TIME::tm_mon` contains a 1-based month number.
Diffstat (limited to 'library/std/src/sys')
-rw-r--r--library/std/src/sys/solid/time.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/sys/solid/time.rs b/library/std/src/sys/solid/time.rs
index c67a736a903..ab988be2444 100644
--- a/library/std/src/sys/solid/time.rs
+++ b/library/std/src/sys/solid/time.rs
@@ -21,7 +21,7 @@ impl SystemTime {
                 tm_min: rtc.tm_min,
                 tm_hour: rtc.tm_hour,
                 tm_mday: rtc.tm_mday,
-                tm_mon: rtc.tm_mon,
+                tm_mon: rtc.tm_mon - 1,
                 tm_year: rtc.tm_year,
                 tm_wday: rtc.tm_wday,
                 tm_yday: 0,