Lines Matching refs:tm
33 int rtc_calc_weekday(struct rtc_time *tm) in rtc_calc_weekday() argument
39 if (tm->tm_year < 1753) in rtc_calc_weekday()
41 last_year = tm->tm_year - 1; in rtc_calc_weekday()
52 if (tm->tm_year % 4 == 0 && in rtc_calc_weekday()
53 ((tm->tm_year % 100 != 0) || (tm->tm_year % 400 == 0)) && in rtc_calc_weekday()
54 tm->tm_mon > 2) { in rtc_calc_weekday()
61 day += last_year * 365 + leaps_to_date + month_offset[tm->tm_mon - 1] + in rtc_calc_weekday()
62 tm->tm_mday; in rtc_calc_weekday()
63 tm->tm_wday = day % 7; in rtc_calc_weekday()
68 int rtc_to_tm(int tim, struct rtc_time *tm) in rtc_to_tm() argument
77 tm->tm_hour = hms / 3600; in rtc_to_tm()
78 tm->tm_min = (hms % 3600) / 60; in rtc_to_tm()
79 tm->tm_sec = (hms % 3600) % 60; in rtc_to_tm()
84 tm->tm_year = i; in rtc_to_tm()
87 if (leapyear(tm->tm_year)) in rtc_to_tm()
92 tm->tm_mon = i; in rtc_to_tm()
95 tm->tm_mday = day + 1; in rtc_to_tm()
98 tm->tm_yday = 0; in rtc_to_tm()
99 tm->tm_isdst = 0; in rtc_to_tm()
104 return rtc_calc_weekday(tm); in rtc_to_tm()
123 unsigned long rtc_mktime(const struct rtc_time *tm) in rtc_mktime() argument
125 int mon = tm->tm_mon; in rtc_mktime()
126 int year = tm->tm_year; in rtc_mktime()
136 367 * mon / 12 + tm->tm_mday) + in rtc_mktime()
138 hours = days * 24 + tm->tm_hour; in rtc_mktime()
139 return (hours * 60 + tm->tm_min) * 60 + tm->tm_sec; in rtc_mktime()