Skip to main content

clock_is_set

Function clock_is_set 

Source
pub fn clock_is_set(ctx: &ServiceContext) -> bool
Expand description

Whether the time service’s clock is worth showing as a date at all.

Says nothing about datetime on a board with no RTC: there Ntp can be true while datetime still reads zeros (see its doc).

True for ClockSource::Rtc and ClockSource::Ntp. False for ClockSource::Unset, and false for ClockSource::Floor - a floor is a real lower bound but not a reading, so a program that only wants to know “may I print this as today’s date” should treat it as no.

Reach for clock_source when the distinction matters, which it does more often than this shorthand suggests.