| Summary: | mktime failure. | ||
|---|---|---|---|
| Product: | Base System | Reporter: | akr <akr> |
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 4.2-RELEASE | ||
| Hardware: | Any | ||
| OS: | Any | ||
<<On Fri, 25 May 2001 11:10:18 +0900 (JST), akr@m17n.org said: > mktime(3) fails on some condition. I am unable to duplicate your problem on a 4.2-STABLE system. I suggest, however, that in the future you completely initialize your `struct tm', as you may be relying on undefined behavior. -GAWollman <<On Fri, 25 May 2001 11:10:18 +0900 (JST), akr@m17n.org said: > mktime(3) fails on some condition. Actually, I retract my previous statement. I can indeed reproduce this bug. I'll ask on the timezone mailing-list whether it is present in the current tzcode. -GAWollman State Changed From-To: open->feedback A fix from the maintainer was committed to current. Does this fix resolve your problem? State Changed From-To: feedback->closed Feedback timeout (6 months). |
mktime(3) fails on some condition. For example, TZ=Africa/Monrovia, 1972/05/01 00:44:30 cannot be converted to time_t. Since this example is taken from `zdump -v Africa/Monrovia' and it is after Epoch, there is no reason to fail. Actually, I tested all time listed in `zdump -v' for each timezone in /usr/share/zoneinfo and found many failures. Above failure is one of them. How-To-Repeat: % cat tst.c #include <stdio.h> #include <time.h> int main() { struct tm a; time_t t; a.tm_year = 1972 - 1900; a.tm_mon = 5 - 1; a.tm_mday = 1; a.tm_hour = 0; a.tm_min = 44; a.tm_sec = 30; a.tm_wday = 0; a.tm_yday = 0; a.tm_isdst = -1; t = mktime(&a); if (t == -1) { perror("mktime"); exit(1); } printf("no problem\n"); return 0; } % gcc tst.c % TZ=Africa/Monrovia ./a.out mktime: Undefined error: 0 %