Function tzdb::now::local_or

source ·
pub fn local_or(default: TimeZoneRef<'_>) -> Result<DateTime, NowError>
Expand description

Get the current time in the local system time zone with a fallback time zone

§Errors

Possible errors include:

  • The current Unix time could not be determined.
  • The current Unix time could not be projected into the time zone. Most likely the system time is off, or you are a time traveler trying run this code a few billion years in the future or past.

§Example

// Query the time zone of the local system, or use GMT as default:
let now = tzdb::now::local_or(tzdb::time_zone::GMT)?;

§See also: