1use ambient_authority::AmbientAuthority;
2use iana_time_zone::get_timezone;
3
4pub struct Timezone(());
6
7#[derive(Debug)]
9pub struct TimezoneError(String);
10
11impl std::error::Error for TimezoneError {}
12
13impl std::fmt::Display for TimezoneError {
14 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15 self.0.fmt(f)
16 }
17}
18
19impl Timezone {
20 #[inline]
26 pub const fn new(ambient_authority: AmbientAuthority) -> Self {
27 let _ = ambient_authority;
28 Self(())
29 }
30
31 #[inline]
35 pub fn timezone_name(&self) -> Result<String, TimezoneError> {
36 get_timezone().map_err(|e| TimezoneError(e.to_string()))
37 }
38}