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 @@ -20,6 +20,7 @@ maybe-owned = "0.3.4"
2020fs-set-times = " 0.20.0"
2121io-extras = " 0.18.0"
2222io-lifetimes = { version = " 2.0.0" , default-features = false }
23+ iana-time-zone = " 0.1.57"
2324
2425[dev-dependencies ]
2526cap-tempfile = { path = " ../cap-tempfile" }
Original file line number Diff line number Diff line change @@ -4,10 +4,12 @@ mod instant;
44mod monotonic_clock;
55mod system_clock;
66mod system_time;
7+ mod timezone;
78
89pub use instant:: Instant ;
910pub use monotonic_clock:: MonotonicClock ;
1011pub use system_clock:: SystemClock ;
1112pub use system_time:: SystemTime ;
13+ pub use timezone:: Timezone ;
1214
1315pub use std:: time:: { Duration , SystemTimeError } ;
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 LocalResult for TimezoneError {
11+ impl Timezone {
12+ /// Constructs a new instance of `Self`.
13+ ///
14+ /// # Ambient Authority
15+ ///
16+ /// This uses ambient authority to accesses clocks.
17+ #[ inline]
18+ pub const fn new ( ambient_authority : AmbientAuthority ) -> Self {
19+ let _ = ambient_authority;
20+ Self ( ( ) )
21+ }
22+
23+ /// Returns the combined date and time with timezone.
24+ ///
25+ /// Converts NaiveTime to DateTime
26+ #[ inline]
27+ pub fn timezone_name ( & self ) -> Result < String , TimezoneError > {
28+ get_timezone ( ) . map_err ( |e| TimezoneError ( e. to_string ( ) ) )
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments