Lines Matching defs:tm
283 struct my_tm *tm = &pThis->current_tm;
285 tm->tm_sec = from_bcd(pThis, pThis->cmos_data[RTC_SECONDS]);
286 tm->tm_min = from_bcd(pThis, pThis->cmos_data[RTC_MINUTES]);
287 tm->tm_hour = from_bcd(pThis, pThis->cmos_data[RTC_HOURS] & 0x7f);
290 tm->tm_hour %= 12;
292 tm->tm_hour += 12;
294 tm->tm_wday = from_bcd(pThis, pThis->cmos_data[RTC_DAY_OF_WEEK]);
295 tm->tm_mday = from_bcd(pThis, pThis->cmos_data[RTC_DAY_OF_MONTH]);
296 tm->tm_mon = from_bcd(pThis, pThis->cmos_data[RTC_MONTH]) - 1;
297 tm->tm_year = from_bcd(pThis, pThis->cmos_data[RTC_YEAR]) + 100;
586 /* update 'tm' to the next second */
587 static void rtc_next_second(struct my_tm *tm)
591 tm->tm_sec++;
592 if ((unsigned)tm->tm_sec >= 60)
594 tm->tm_sec = 0;
595 tm->tm_min++;
596 if ((unsigned)tm->tm_min >= 60)
598 tm->tm_min = 0;
599 tm->tm_hour++;
600 if ((unsigned)tm->tm_hour >= 24)
602 tm->tm_hour = 0;
604 tm->tm_wday++;
605 if ((unsigned)tm->tm_wday >= 7)
606 tm->tm_wday = 0;
607 days_in_month = get_days_in_month(tm->tm_mon,
608 tm->tm_year + 1900);
609 tm->tm_mday++;
610 if (tm->tm_mday < 1)
611 tm->tm_mday = 1;
612 else if (tm->tm_mday > days_in_month)
614 tm->tm_mday = 1;
615 tm->tm_mon++;
616 if (tm->tm_mon >= 12)
618 tm->tm_mon = 0;
619 tm->tm_year++;
664 const struct my_tm *tm = &pThis->current_tm;
666 pThis->cmos_data[RTC_SECONDS] = to_bcd(pThis, tm->tm_sec);
667 pThis->cmos_data[RTC_MINUTES] = to_bcd(pThis, tm->tm_min);
671 pThis->cmos_data[RTC_HOURS] = to_bcd(pThis, tm->tm_hour);
676 int h = tm->tm_hour % 12;
678 if (tm->tm_hour >= 12)
681 pThis->cmos_data[RTC_DAY_OF_WEEK] = to_bcd(pThis, tm->tm_wday);
682 pThis->cmos_data[RTC_DAY_OF_MONTH] = to_bcd(pThis, tm->tm_mday);
683 pThis->cmos_data[RTC_MONTH] = to_bcd(pThis, tm->tm_mon + 1);
684 pThis->cmos_data[RTC_YEAR] = to_bcd(pThis, tm->tm_year % 100);
978 static void rtc_set_date(PRTCSTATE pThis, const struct my_tm *tm)
980 pThis->current_tm = *tm;