Lines Matching refs:tm
56 _der_timegm (struct tm *tm)
64 if (tm->tm_year > ASN1_MAX_YEAR)
67 if (tm->tm_year < 0)
69 if (tm->tm_mon < 0 || tm->tm_mon > 11)
71 if (tm->tm_mday < 1 || tm->tm_mday > (int)ndays[is_leap(tm->tm_year)][tm->tm_mon])
73 if (tm->tm_hour < 0 || tm->tm_hour > 23)
75 if (tm->tm_min < 0 || tm->tm_min > 59)
77 if (tm->tm_sec < 0 || tm->tm_sec > 59)
80 for (i = 70; i < tm->tm_year; ++i)
83 for (i = 0; i < tm->tm_mon; ++i)
84 res += ndays[is_leap(tm->tm_year)][i];
85 res += tm->tm_mday - 1;
87 res += tm->tm_hour;
89 res += tm->tm_min;
91 res += tm->tm_sec;
95 struct tm *
96 _der_gmtime(time_t t, struct tm *tm)
101 memset(tm, 0, sizeof(*tm));
103 tm->tm_sec = secday % 60;
104 tm->tm_min = (secday % 3600) / 60;
105 tm->tm_hour = secday / 3600;
116 tm->tm_year = 70;
118 unsigned dayinyear = (is_leap(tm->tm_year) ? 366 : 365);
121 tm->tm_year += 1;
124 tm->tm_mon = 0;
127 unsigned daysinmonth = ndays[is_leap(tm->tm_year)][tm->tm_mon];
131 tm->tm_mon++;
133 tm->tm_mday = days + 1;
135 return tm;