| 1 |
#[path = "Windows.rs"] |
| 2 |
#[allow(missing_debug_implementations, clippy::undocumented_unsafe_blocks)] |
| 3 |
mod windows; |
| 4 |
|
| 5 |
use windows::Globalization::Calendar; |
| 6 |
|
| 7 |
impl From<windows_core::Error> for crate::GetTimezoneError { |
| 8 |
fn from(orig: windows_core::Error) -> Self { |
| 9 |
crate::GetTimezoneError::IoError(std::io::Error::new(std::io::ErrorKind::Other, orig)) |
| 10 |
} |
| 11 |
} |
| 12 |
|
| 13 |
pub(crate) fn get_timezone_inner() -> Result<String, crate::GetTimezoneError> { |
| 14 |
let cal = Calendar::new()?; |
| 15 |
let tz_hstring = cal.GetTimeZone()?; |
| 16 |
Ok(tz_hstring.to_string()) |
| 17 |
} |