Expand description

Time is an abstraction of dates and times.

This module implements the Time class from Ruby Core.

In Artichoke, Time is represented as a 64-bit signed integer of seconds since January 1, 1970 UTC (the Unix Epoch) and an unsigned 32-bit integer of subsecond nanoseconds. This allows representing roughly 584 billion years.

You can use this class in your application by accessing it directly. As a Core class, it is globally available:

Time.now

This implementation of Time is dependent on the selected feature. The tzrs feature uses the tzdb crate for getting the local timezone information, and combines with the tz-rs crate to generate the time.

Crate features

This crate can support several backends, which are designed to be independent of each other. The availability of different backends is controlled by Cargo features, all of which are enabled by default:

  • tzrs: Enable a Time backend which is implemented by the tz-rs and tzdb crates.

Additional features

  • tzrs-local: Enable the detection of the system timezone with the tzrs backend. This feature is enabled by default. Enabling this feature also activates the tzrs feature.

    If the tzrs-local feature is disabled, the local timezone is defaulted to GMT (not UTC).

This crate requires std, the Rust Standard Library.

Re-exports

pub use strftime;

Modules

A Time struct backed by the tz-rs crate.

Constants

Number of microseconds in one nanosecond.
Number of nanoseconds in one second.