Lines Matching refs:tm
58 _der_timegm (struct tm *tm)
66 if (tm->tm_year > ASN1_MAX_YEAR)
69 if (tm->tm_year < 0)
71 if (tm->tm_mon < 0 || tm->tm_mon > 11)
73 if (tm->tm_mday < 1 || tm->tm_mday > (int)ndays[is_leap(tm->tm_year)][tm->tm_mon])
75 if (tm->tm_hour < 0 || tm->tm_hour > 23)
77 if (tm->tm_min < 0 || tm->tm_min > 59)
79 if (tm->tm_sec < 0 || tm->tm_sec > 59)
82 for (i = 70; i < tm->tm_year; ++i)
85 for (i = 0; i < tm->tm_mon; ++i)
86 res += ndays[is_leap(tm->tm_year)][i];
87 res += tm->tm_mday - 1;
89 res += tm->tm_hour;
91 res += tm->tm_min;
93 res += tm->tm_sec;
97 struct tm *
98 _der_gmtime(time_t t, struct tm *tm)
103 memset(tm, 0, sizeof(*tm));
105 tm->tm_sec = secday % 60;
106 tm->tm_min = (secday % 3600) / 60;
107 tm->tm_hour = (int)(secday / 3600);
118 tm->tm_year = 70;
120 unsigned dayinyear = (is_leap(tm->tm_year) ? 366 : 365);
123 tm->tm_year += 1;
126 tm->tm_mon = 0;
129 unsigned daysinmonth = ndays[is_leap(tm->tm_year)][tm->tm_mon];
133 tm->tm_mon++;
135 tm->tm_mday = (int)(days + 1);
137 return tm;