Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/clock.h
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | struct clocktime { | ||||
int hour; /* hour (0 - 23) */ | int hour; /* hour (0 - 23) */ | ||||
int min; /* minute (0 - 59) */ | int min; /* minute (0 - 59) */ | ||||
int sec; /* second (0 - 59) */ | int sec; /* second (0 - 59) */ | ||||
int dow; /* day of week (0 - 6; 0 = Sunday) */ | int dow; /* day of week (0 - 6; 0 = Sunday) */ | ||||
long nsec; /* nano seconds */ | long nsec; /* nano seconds */ | ||||
}; | }; | ||||
int clock_ct_to_ts(const struct clocktime *, struct timespec *); | int clock_ct_to_ts(const struct clocktime *, struct timespec *); | ||||
void clock_ts_to_ct(const struct timespec *, struct clocktime *); | int clock_ts_to_ct(const struct timespec *, struct clocktime *); | ||||
/* | /* | ||||
* Structure to hold the values typically reported by time-of-day clocks, | * Structure to hold the values typically reported by time-of-day clocks, | ||||
* expressed as BCD. This can be passed to the conversion functions to be | * expressed as BCD. This can be passed to the conversion functions to be | ||||
* converted to/from a struct timespec. | * converted to/from a struct timespec. | ||||
* | * | ||||
* The clock_bcd_to_ts() function interprets the values in the year through sec | * The clock_bcd_to_ts() function interprets the values in the year through sec | ||||
* fields as BCD numbers, and returns EINVAL if any BCD values are out of range. | * fields as BCD numbers, and returns EINVAL if any BCD values are out of range. | ||||
Show All 20 Lines | struct bcd_clocktime { | ||||
uint8_t min; /* minute (0 - 59) */ | uint8_t min; /* minute (0 - 59) */ | ||||
uint8_t sec; /* second (0 - 59) */ | uint8_t sec; /* second (0 - 59) */ | ||||
uint8_t dow; /* day of week (0 - 6; 0 = Sunday) */ | uint8_t dow; /* day of week (0 - 6; 0 = Sunday) */ | ||||
long nsec; /* nanoseconds */ | long nsec; /* nanoseconds */ | ||||
bool ispm; /* true if hour represents pm time */ | bool ispm; /* true if hour represents pm time */ | ||||
}; | }; | ||||
int clock_bcd_to_ts(const struct bcd_clocktime *, struct timespec *, bool ampm); | int clock_bcd_to_ts(const struct bcd_clocktime *, struct timespec *, bool ampm); | ||||
void clock_ts_to_bcd(const struct timespec *, struct bcd_clocktime *, bool ampm); | int clock_ts_to_bcd(const struct timespec *, struct bcd_clocktime *, bool ampm); | ||||
/* | /* | ||||
* Time-of-day clock functions and flags. These functions might sleep. | * Time-of-day clock functions and flags. These functions might sleep. | ||||
* | * | ||||
* clock_register and clock_unregister() do what they say. Upon return from | * clock_register and clock_unregister() do what they say. Upon return from | ||||
* unregister, the clock's methods are not running and will not be called again. | * unregister, the clock's methods are not running and will not be called again. | ||||
* | * | ||||
* clock_schedule() requests that a registered clock's clock_settime() calls | * clock_schedule() requests that a registered clock's clock_settime() calls | ||||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |