Expand description
An instance-local, reprogrammable, real time clock.
This crate’s primary export is the LocalClock
trait, which defines an
interface for interacting with instances of reprogrammable real time clocks,
decoupled from any particular platform’s global real time clock.
Also included in local_time
is SystemTimeClock
, which is a basic
in-tree implementation of LocalClock
backed by
std::time::SystemTime
. Unless you’re worried about handling instances
where SystemTime
jumps backwards, this is perfectly reasonable
implementation to use.
This crate deliberately takes a minimalist approach to dependencies, and
avoids pulling in any “heavyweight” date/time crates by default (e.g:
time
, chrono
, etc…). That said, native integration with some of these
crates is provided via optional features.
§Features
inspect
- Derives theInspect
trait on various types.time_exts
- Integration with the [time
] crate- Provides
From
/Into
implementations to interop with duration and date/time types fromtime
. - Changes the
Debug
implementation ofLocalClockTime
to print a human readable date (instead of a raw duration since the Unix Epoch).
- Provides
Structs§
- Local
Clock Delta - A delta between two
LocalClockTime
instances. - Local
Clock Time - An opaque type, representing an instant in time.
- Mock
Local Clock - A mock implementation of
LocalClock
, which is manually ticked via aMockLocalClockAccessor
. Useful for tests. - Mock
Local Clock Accessor - Handle to manually tick an instance of
MockLocalClock
. - Overflow
Error - Indicates that an overflow error occurred during conversion.
- System
Time Clock - An implementation of
LocalClock
backed bystd::time::SystemTime
.
Traits§
- Inspectable
Local Clock - Extends
LocalClock
with a bound onInspect
- Local
Clock - A local real-time clock, hanging-off the platform’s global real-time clock.