File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,11 @@ impl<H: HostHooks> Now<H> {
1212 self . time_zone_with_provider ( & * TZ_PROVIDER )
1313 }
1414
15+ /// Converts the current [`Now`] into an [`ZonedDateTime`] with an ISO8601 calendar.
16+ pub fn zoned_date_time_iso ( self , time_zone : Option < TimeZone > ) -> TemporalResult < ZonedDateTime > {
17+ self . zoned_date_time_iso_with_provider ( time_zone, & * TZ_PROVIDER )
18+ }
19+
1520 /// Returns the current system time as a [`PlainDateTime`] with an optional
1621 /// [`TimeZone`].
1722 ///
@@ -35,9 +40,4 @@ impl<H: HostHooks> Now<H> {
3540 pub fn plain_time_iso ( self , time_zone : Option < TimeZone > ) -> TemporalResult < PlainTime > {
3641 self . plain_time_with_provider ( time_zone, & * TZ_PROVIDER )
3742 }
38-
39- /// Converts the current [`Now`] into an [`ZonedDateTime`] with an ISO8601 calendar.
40- pub fn zoned_date_time_iso ( self , time_zone : Option < TimeZone > ) -> TemporalResult < ZonedDateTime > {
41- self . zoned_date_time_iso_with_provider ( time_zone, & * TZ_PROVIDER )
42- }
4343}
Original file line number Diff line number Diff line change @@ -30,7 +30,9 @@ impl<H: HostHooks> Now<H> {
3030 let time_zone = time_zone. unwrap_or ( self . host_hooks . get_system_time_zone ( provider) ?) ;
3131 time_zone. get_iso_datetime_for ( & Instant :: from ( system_nanoseconds) , provider)
3232 }
33+ }
3334
35+ impl < H : HostHooks > Now < H > {
3436 /// Converts the current [`Now`] into a [`TimeZone`].
3537 pub fn time_zone_with_provider (
3638 self ,
@@ -57,9 +59,7 @@ impl<H: HostHooks> Now<H> {
5759 let instant = Instant :: from ( system_nanoseconds) ;
5860 ZonedDateTime :: new_unchecked_with_provider ( instant, time_zone, Calendar :: ISO , provider)
5961 }
60- }
6162
62- impl < H : HostHooks > Now < H > {
6363 /// Converts `Now` into the current system [`PlainDateTime`] with an ISO8601 calendar.
6464 ///
6565 /// When `TimeZone` is `None`, the value will default to the
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ pub struct Temporal;
2525
2626impl Temporal {
2727 /// Get a `Now` object for the default host system.
28- pub fn now ( ) -> Now < DefaultHostSystem > {
28+ pub const fn now ( ) -> Now < DefaultHostSystem > {
2929 Now :: new ( DefaultHostSystem )
3030 }
3131}
You can’t perform that action at this time.
0 commit comments