Skip to content

Commit

Permalink
fix unsigned to signed conversion bug (#656)
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoryLakewood authored Feb 3, 2024
1 parent 76468cb commit ef7bfbd
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions time/src/sys/local_offset_at/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ fn systemtime_to_filetime(systime: &SystemTime) -> Option<FileTime> {
/// Convert a `FILETIME` to an `i64`, representing a number of seconds.
fn filetime_to_secs(filetime: &FileTime) -> i64 {
/// FILETIME represents 100-nanosecond intervals
const FT_TO_SECS: i64 = Nanosecond::per(Second) as i64 / 100;
(filetime.dwHighDateTime.cast_signed().extend::<i64>() << 32
| filetime.dwLowDateTime.cast_signed().extend::<i64>())
/ FT_TO_SECS
const FT_TO_SECS: u64 = Nanosecond::per(Second) as u64 / 100;
((filetime.dwHighDateTime.extend::<u64>() << 32 | filetime.dwLowDateTime.extend::<u64>())
/ FT_TO_SECS) as i64
}

/// Convert an [`OffsetDateTime`] to a `SYSTEMTIME`.
Expand Down

0 comments on commit ef7bfbd

Please sign in to comment.