iana-time-zone 0.1.38

get the IANA time zone for the current system
Documentation
1
2
3
4
5
6
7
pub(crate) fn get_timezone_inner() -> Result<String, crate::GetTimezoneError> {
    // see https://stackoverflow.com/a/12523283
    let mut contents = std::fs::read_to_string("/etc/timezone")?;
    // Trim to the correct length without allocating.
    contents.truncate(contents.trim_end().len());
    Ok(contents)
}