Clearner fix for timegm assert problem.

svn:r5690
This commit is contained in:
Nick Mathewson 2006-01-01 23:13:19 +00:00
parent 04db9de847
commit 0da2069643

View File

@ -648,11 +648,8 @@ tor_timegm(struct tm *tm)
year = tm->tm_year + 1900; year = tm->tm_year + 1900;
if (year < 1970 || tm->tm_mon < 0 || tm->tm_mon > 11) { if (year < 1970 || tm->tm_mon < 0 || tm->tm_mon > 11) {
warn(LD_BUG, "Out-of-range argument to tor_timegm"); warn(LD_BUG, "Out-of-range argument to tor_timegm");
return 0; return -1;
} }
tor_assert(year >= 1970);
tor_assert(tm->tm_mon >= 0);
tor_assert(tm->tm_mon <= 11);
days = 365 * (year-1970) + n_leapdays(1970,year); days = 365 * (year-1970) + n_leapdays(1970,year);
for (i = 0; i < tm->tm_mon; ++i) for (i = 0; i < tm->tm_mon; ++i)
days += days_per_month[i]; days += days_per_month[i];