Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/iicbus/ds13rtc.c
Show First 20 Lines • Show All 417 Lines • ▼ Show 20 Lines | ds13rtc_settime(device_t dev, struct timespec *ts) | ||||
* disables utc adjustment, so apply that ourselves. | * disables utc adjustment, so apply that ourselves. | ||||
*/ | */ | ||||
ts->tv_sec -= utc_offset(); | ts->tv_sec -= utc_offset(); | ||||
/* If the chip counts time in binary, store tv_sec and we're done. */ | /* If the chip counts time in binary, store tv_sec and we're done. */ | ||||
if (sc->is_binary_counter) | if (sc->is_binary_counter) | ||||
return (write_timeword(sc, ts->tv_sec)); | return (write_timeword(sc, ts->tv_sec)); | ||||
clock_ts_to_bcd(ts, &bct, sc->use_ampm); | err = clock_ts_to_bcd(ts, &bct, sc->use_ampm); | ||||
if (err) | |||||
return (err); | |||||
clock_dbgprint_bcd(sc->dev, CLOCK_DBG_WRITE, &bct); | clock_dbgprint_bcd(sc->dev, CLOCK_DBG_WRITE, &bct); | ||||
/* If the chip is in AMPM mode deal with the PM flag. */ | /* If the chip is in AMPM mode deal with the PM flag. */ | ||||
pmflags = 0; | pmflags = 0; | ||||
if (sc->use_ampm) { | if (sc->use_ampm) { | ||||
pmflags = DS13xx_B_HOUR_AMPM; | pmflags = DS13xx_B_HOUR_AMPM; | ||||
if (bct.ispm) | if (bct.ispm) | ||||
pmflags |= DS13xx_B_HOUR_PM; | pmflags |= DS13xx_B_HOUR_PM; | ||||
▲ Show 20 Lines • Show All 185 Lines • Show Last 20 Lines |