| 1 |
pub const TIME_ZONE_ID_INVALID: u32 = 0xffffffff; |
| 2 |
|
| 3 |
// MSRV(??): Must be marked as public to avoid errors in older Rust compilers. |
| 4 |
// Rust 1.71 needs this. But Rust 1.95 does not. I'm not sure where the cross |
| 5 |
// over point is, but it'd be nice to tighten this up a bit. In any case, this |
| 6 |
// isn't actually re-exported anywhere in Jiff's public API, so it's fine. |
| 7 |
// ---AG |
| 8 |
#[repr(C)] |
| 9 |
pub struct DYNAMIC_TIME_ZONE_INFORMATION { |
| 10 |
bias: i32, |
| 11 |
standard_name: [u16; 32], |
| 12 |
standard_date: SYSTEMTIME, |
| 13 |
standard_bias: i32, |
| 14 |
daylight_name: [u16; 32], |
| 15 |
daylight_date: SYSTEMTIME, |
| 16 |
daylight_bias: i32, |
| 17 |
// This is the only field we actually need. |
| 18 |
pub timezone_key_name: [u16; 128], |
| 19 |
dynamic_daylight_time_disabled: u8, |
| 20 |
} |
| 21 |
|
| 22 |
#[repr(C)] |
| 23 |
struct SYSTEMTIME { |
| 24 |
year: u16, |
| 25 |
month: u16, |
| 26 |
day_of_week: u16, |
| 27 |
day: u16, |
| 28 |
hour: u16, |
| 29 |
minute: u16, |
| 30 |
seconds: u16, |
| 31 |
milliseconds: u16, |
| 32 |
} |
| 33 |
|
| 34 |
/// Retrieves the current time zone and dynamic daylight saving time settings. |
| 35 |
/// |
| 36 |
/// These settings control the translations between Coordinated Universal Time |
| 37 |
/// (UTC) and local time.. |
| 38 |
/// |
| 39 |
/// See: <https://learn.microsoft.com/en-us/windows/win32/api/timezoneapi/nf-timezoneapi-getdynamictimezoneinformation> |
| 40 |
windows_link::link!("kernel32.dll" "system" fn GetDynamicTimeZoneInformation(info: *mut DYNAMIC_TIME_ZONE_INFORMATION) -> u32); |