Lines Matching refs:time
29 /* RTC date/time ... the main special cases are that we:
187 * Get/set of date and time is pretty normal.
190 static int ds1305_get_time(struct device *dev, struct rtc_time *time)
197 /* Use write-then-read to get all the date/time registers
210 time->tm_sec = bcd2bin(buf[DS1305_SEC]);
211 time->tm_min = bcd2bin(buf[DS1305_MIN]);
212 time->tm_hour = bcd2hour(buf[DS1305_HOUR]);
213 time->tm_wday = buf[DS1305_WDAY] - 1;
214 time->tm_mday = bcd2bin(buf[DS1305_MDAY]);
215 time->tm_mon = bcd2bin(buf[DS1305_MON]) - 1;
216 time->tm_year = bcd2bin(buf[DS1305_YEAR]) + 100;
220 "read", time->tm_sec, time->tm_min,
221 time->tm_hour, time->tm_mday,
222 time->tm_mon, time->tm_year, time->tm_wday);
225 return rtc_valid_tm(time);
228 static int ds1305_set_time(struct device *dev, struct rtc_time *time)
236 "write", time->tm_sec, time->tm_min,
237 time->tm_hour, time->tm_mday,
238 time->tm_mon, time->tm_year, time->tm_wday);
240 /* Write registers starting at the first time/date address. */
243 *bp++ = bin2bcd(time->tm_sec);
244 *bp++ = bin2bcd(time->tm_min);
245 *bp++ = hour2bcd(ds1305->hr12, time->tm_hour);
246 *bp++ = (time->tm_wday < 7) ? (time->tm_wday + 1) : 1;
247 *bp++ = bin2bcd(time->tm_mday);
248 *bp++ = bin2bcd(time->tm_mon + 1);
249 *bp++ = bin2bcd(time->tm_year - 100);
329 /* Stuff these values into alm->time and let RTC framework code
333 alm->time.tm_sec = bcd2bin(buf[DS1305_SEC]);
334 alm->time.tm_min = bcd2bin(buf[DS1305_MIN]);
335 alm->time.tm_hour = bcd2hour(buf[DS1305_HOUR]);
336 alm->time.tm_mday = -1;
337 alm->time.tm_mon = -1;
338 alm->time.tm_year = -1;
340 alm->time.tm_wday = -1;
341 alm->time.tm_mday = -1;
342 alm->time.tm_isdst = -1;
360 status = rtc_tm_to_time(&alm->time, &later);
364 /* Read current time as time_t */
391 buf[1 + DS1305_SEC] = bin2bcd(alm->time.tm_sec);
392 buf[1 + DS1305_MIN] = bin2bcd(alm->time.tm_min);
393 buf[1 + DS1305_HOUR] = hour2bcd(ds1305->hr12, alm->time.tm_hour);
703 /* this may need one-time (re)init */