From ef7bfbd638777f2400df0b6eced90e5b0df93358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Grabowski?= <48591475+GregoryLakewood@users.noreply.github.com> Date: Sat, 3 Feb 2024 06:02:32 +0100 Subject: [PATCH] fix unsigned to signed conversion bug (#656) --- time/src/sys/local_offset_at/windows.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/time/src/sys/local_offset_at/windows.rs b/time/src/sys/local_offset_at/windows.rs index f37551af7..d14429209 100644 --- a/time/src/sys/local_offset_at/windows.rs +++ b/time/src/sys/local_offset_at/windows.rs @@ -59,10 +59,9 @@ fn systemtime_to_filetime(systime: &SystemTime) -> Option { /// 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::() << 32 - | filetime.dwLowDateTime.cast_signed().extend::()) - / FT_TO_SECS + const FT_TO_SECS: u64 = Nanosecond::per(Second) as u64 / 100; + ((filetime.dwHighDateTime.extend::() << 32 | filetime.dwLowDateTime.extend::()) + / FT_TO_SECS) as i64 } /// Convert an [`OffsetDateTime`] to a `SYSTEMTIME`.