Skip to content

Commit

Permalink
fix unsigned to signed conversion bug
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoryLakewood committed Feb 2, 2024
1 parent ff3255f commit fd9e4ff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 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,10 @@ 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 fd9e4ff

Please sign in to comment.