summaryrefslogtreecommitdiffstats
path: root/vendor/iana-time-zone/src/tz_windows.rs
blob: eaa5d5a48b79cc19ae97f03c055865c14d042443 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
use windows::Globalization::Calendar;

impl From<windows::core::Error> for crate::GetTimezoneError {
    fn from(orig: windows::core::Error) -> Self {
        crate::GetTimezoneError::IoError(std::io::Error::new(std::io::ErrorKind::Other, orig))
    }
}

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