File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed
Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,10 @@ repository = "https://github.com/bytecodealliance/cap-std"
1313edition = " 2021"
1414
1515[dependencies ]
16+ ambient-authority = " 0.0.2"
1617cap-primitives = { path = " ../cap-primitives" , version = " ^2.0.0" }
1718cap-std = { path = " ../cap-std" , optional = true , version = " ^2.0.0" }
19+ iana-time-zone = " 0.1.57"
1820
1921[target .'cfg(not(windows))' .dependencies ]
2022rustix = { version = " 0.38.0" , features = [" time" ] }
Original file line number Diff line number Diff line change 1111
1212mod monotonic_clock;
1313mod system_clock;
14+ mod timezone;
1415
1516pub use monotonic_clock:: MonotonicClockExt ;
1617pub use system_clock:: SystemClockExt ;
18+ pub use timezone:: Timezone ;
Original file line number Diff line number Diff line change 1+ use ambient_authority:: AmbientAuthority ;
2+ use iana_time_zone:: get_timezone;
3+
4+ /// A reference to a timezone resource.
5+ pub struct Timezone ( ( ) ) ;
6+
7+ #[ derive( Debug ) ]
8+ pub struct TimezoneError ( String ) ;
9+
10+ impl Timezone {
11+ /// Constructs a new instance of `Self`.
12+ ///
13+ /// # Ambient Authority
14+ ///
15+ /// This uses ambient authority to accesses clocks.
16+ #[ inline]
17+ pub const fn new ( ambient_authority : AmbientAuthority ) -> Self {
18+ let _ = ambient_authority;
19+ Self ( ( ) )
20+ }
21+
22+ /// Returns the combined date and time with timezone.
23+ ///
24+ /// Converts NaiveTime to DateTime
25+ #[ inline]
26+ pub fn timezone_name ( & self ) -> Result < String , TimezoneError > {
27+ get_timezone ( ) . map_err ( |e| TimezoneError ( e. to_string ( ) ) )
28+ }
29+ }
You can’t perform that action at this time.
0 commit comments