Crate rtcc

source ·
Expand description

Data structures and traits to be implemented by real-time clock / calendar devices.

Prefer to use only the methods from the DateTimeAccess rather than the individual methods from the Rtcc trait to avoid situations where the passing of time makes the results of the method calls inconsistent if you combine the results of several methods.

For example, this can happen at certain timepoints:

  1. The time is 01:59:59
  2. A call to hours() returns 1.
  3. The time is increased to 02:00:00.
  4. A call to minutes() returns 0.
  5. A call to seconds() returns 0.
  6. Your system thinks it is 01:00:00.

The same applies to the date as well, as well as when calling setter methods.

Structs§

  • ISO 8601 combined date and time with time zone.
  • ISO 8601 calendar date without timezone. Allows for every proleptic Gregorian date from Jan 1, 262145 BCE to Dec 31, 262143 CE. Also supports the conversion from ISO 8601 ordinal and week date.
  • ISO 8601 combined date and time without timezone.
  • ISO 8601 time without timezone. Allows for the nanosecond precision and optional leap second representation.

Enums§

  • Hours in either 12-hour (AM/PM) or 24-hour format

Traits§

  • Real-Time Clock / Calendar DateTimeAccess trait to read/write a complete date/time.
  • The common set of methods for date component.
  • Real-Time Clock / Calendar trait
  • The common set of methods for time component.