rtcc

Trait Rtcc

Source
pub trait Rtcc: DateTimeAccess {
Show 18 methods // Required methods fn seconds(&mut self) -> Result<u8, Self::Error>; fn minutes(&mut self) -> Result<u8, Self::Error>; fn hours(&mut self) -> Result<Hours, Self::Error>; fn time(&mut self) -> Result<NaiveTime, Self::Error>; fn weekday(&mut self) -> Result<u8, Self::Error>; fn day(&mut self) -> Result<u8, Self::Error>; fn month(&mut self) -> Result<u8, Self::Error>; fn year(&mut self) -> Result<u16, Self::Error>; fn date(&mut self) -> Result<NaiveDate, Self::Error>; fn set_seconds(&mut self, seconds: u8) -> Result<(), Self::Error>; fn set_minutes(&mut self, minutes: u8) -> Result<(), Self::Error>; fn set_hours(&mut self, hours: Hours) -> Result<(), Self::Error>; fn set_time(&mut self, time: &NaiveTime) -> Result<(), Self::Error>; fn set_weekday(&mut self, weekday: u8) -> Result<(), Self::Error>; fn set_day(&mut self, day: u8) -> Result<(), Self::Error>; fn set_month(&mut self, month: u8) -> Result<(), Self::Error>; fn set_year(&mut self, year: u16) -> Result<(), Self::Error>; fn set_date(&mut self, date: &NaiveDate) -> Result<(), Self::Error>;
}
Expand description

Real-Time Clock / Calendar trait

If you want to combine calls to these methods, prefer to use only the DateTimeAccess trait to avoid situations where the passing of time makes the results of the method calls inconsistent.

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 when calling setter methods.

Required Methods§

Source

fn seconds(&mut self) -> Result<u8, Self::Error>

Read the seconds.

Source

fn minutes(&mut self) -> Result<u8, Self::Error>

Read the minutes.

Source

fn hours(&mut self) -> Result<Hours, Self::Error>

Read the hours.

Source

fn time(&mut self) -> Result<NaiveTime, Self::Error>

Read the time.

Source

fn weekday(&mut self) -> Result<u8, Self::Error>

Read the day of the week [1-7].

Source

fn day(&mut self) -> Result<u8, Self::Error>

Read the day of the month [1-31].

Source

fn month(&mut self) -> Result<u8, Self::Error>

Read the month [1-12].

Source

fn year(&mut self) -> Result<u16, Self::Error>

Read the year (e.g. 2000).

Source

fn date(&mut self) -> Result<NaiveDate, Self::Error>

Read the date.

Source

fn set_seconds(&mut self, seconds: u8) -> Result<(), Self::Error>

Set the seconds [0-59].

Source

fn set_minutes(&mut self, minutes: u8) -> Result<(), Self::Error>

Set the minutes [0-59].

Source

fn set_hours(&mut self, hours: Hours) -> Result<(), Self::Error>

Set the hours.

Changes the operating mode to 12h/24h depending on the parameter.

Source

fn set_time(&mut self, time: &NaiveTime) -> Result<(), Self::Error>

Set the time.

Source

fn set_weekday(&mut self, weekday: u8) -> Result<(), Self::Error>

Set the day of week [1-7].

Source

fn set_day(&mut self, day: u8) -> Result<(), Self::Error>

Set the day of month [1-31].

Source

fn set_month(&mut self, month: u8) -> Result<(), Self::Error>

Set the month [1-12].

Source

fn set_year(&mut self, year: u16) -> Result<(), Self::Error>

Set the year. (e.g. 2000)

Source

fn set_date(&mut self, date: &NaiveDate) -> Result<(), Self::Error>

Set the date.

Implementors§