Skip to content

Commit

Permalink
add SYSTEMTIME to Weekday comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDenton committed Jan 26, 2024
1 parent 6090c9c commit 7555f1c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/offset/local/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ fn systemtime_to_naive_dt(st: SYSTEMTIME, year: i32) -> Option<NaiveDateTime> {
st.wSecond as u32,
st.wMilliseconds as u32,
)?;
// In Chrono's Weekday, Monday is 0 whereas in SYSTEMTIME Monday is 1 and Sunday is 0.
// Therefore we move back one day after converting the u16 value to a Weekday.
let day_of_week = Weekday::try_from(u8::try_from(st.wDayOfWeek).ok()?).ok()?.pred();
let date = if st.wYear == 0 {
if let Some(date) =
Expand Down

0 comments on commit 7555f1c

Please sign in to comment.