iana-time-zone 0.1.28

get the IANA time zone for the current system
Documentation
1
2
3
4
5
6
7
8
9
10
pub(crate) fn get_timezone_inner() -> Result<String, crate::GetTimezoneError> {
    // see https://stackoverflow.com/a/12523283
    use std::io::Read;

    let fname = "/etc/timezone";
    let mut f = std::fs::File::open(&fname)?;
    let mut contents = String::new();
    f.read_to_string(&mut contents)?;
    Ok(contents.trim().to_string())
}