iana-time-zone 0.1.16

get the IANA time zone for the current system
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
mod bindings {
    ::windows::include_bindings!();
}

use bindings::Windows::Globalization::Calendar;

impl std::convert::From<windows::Error> for crate::GetTimezoneError {
    fn from(_orig: windows::Error) -> Self {
        crate::GetTimezoneError::OsError
    }
}

pub(crate) fn get_timezone_inner() -> std::result::Result<String, crate::GetTimezoneError> {
    let cal = Calendar::new()?;
    let tz_hstring = cal.GetTimeZone()?;
    Ok(tz_hstring.to_string())
}