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"
13
13
edition = " 2021"
14
14
15
15
[dependencies ]
16
+ ambient-authority = " 0.0.2"
16
17
cap-primitives = { path = " ../cap-primitives" , version = " ^2.0.0" }
17
18
cap-std = { path = " ../cap-std" , optional = true , version = " ^2.0.0" }
19
+ iana-time-zone = " 0.1.57"
18
20
19
21
[target .'cfg(not(windows))' .dependencies ]
20
22
rustix = { version = " 0.38.0" , features = [" time" ] }
Original file line number Diff line number Diff line change 11
11
12
12
mod monotonic_clock;
13
13
mod system_clock;
14
+ mod timezone;
14
15
15
16
pub use monotonic_clock:: MonotonicClockExt ;
16
17
pub 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