Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/efidev/efirtc.c
Show First 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | efirtc_gettime(device_t dev, struct timespec *ts) | ||||
return (clock_ct_to_ts(&ct, ts)); | return (clock_ct_to_ts(&ct, ts)); | ||||
} | } | ||||
static int | static int | ||||
efirtc_settime(device_t dev, struct timespec *ts) | efirtc_settime(device_t dev, struct timespec *ts) | ||||
{ | { | ||||
struct clocktime ct; | struct clocktime ct; | ||||
struct efi_tm tm; | struct efi_tm tm; | ||||
int err; | |||||
/* | /* | ||||
* We request a timespec with no resolution-adjustment so that we can | * We request a timespec with no resolution-adjustment so that we can | ||||
* apply it ourselves based on whether or not the clock zeroes the | * apply it ourselves based on whether or not the clock zeroes the | ||||
* sub-second part of the time when setting the time. | * sub-second part of the time when setting the time. | ||||
*/ | */ | ||||
ts->tv_sec -= utc_offset(); | ts->tv_sec -= utc_offset(); | ||||
if (!efirtc_zeroes_subseconds) | if (!efirtc_zeroes_subseconds) | ||||
timespecadd(ts, &efirtc_resadj, ts); | timespecadd(ts, &efirtc_resadj, ts); | ||||
clock_ts_to_ct(ts, &ct); | err = clock_ts_to_ct(ts, &ct); | ||||
if (err) | |||||
return (err); | |||||
clock_dbgprint_ct(dev, CLOCK_DBG_WRITE, &ct); | clock_dbgprint_ct(dev, CLOCK_DBG_WRITE, &ct); | ||||
bzero(&tm, sizeof(tm)); | bzero(&tm, sizeof(tm)); | ||||
tm.tm_sec = ct.sec; | tm.tm_sec = ct.sec; | ||||
tm.tm_min = ct.min; | tm.tm_min = ct.min; | ||||
tm.tm_hour = ct.hour; | tm.tm_hour = ct.hour; | ||||
tm.tm_mday = ct.day; | tm.tm_mday = ct.day; | ||||
tm.tm_mon = ct.mon; | tm.tm_mon = ct.mon; | ||||
Show All 29 Lines |