1 --- uClibc/libc/misc/time/time.c (revision 16488)
2 +++ uClibc/libc/misc/time/time.c (working copy)
4 #define TZNAME_MAX _POSIX_TZNAME_MAX
7 +#if defined (L_tzset) || defined (L_localtime_r) || defined(L_strftime) || \
8 + defined(L__time_mktime) || defined(L__time_mktime_tzi) || \
9 + ((defined(L_strftime) || defined(L_strftime_l)) && \
10 + defined(__UCLIBC_HAS_XLOCALE__))
12 +void _time_tzset (int);
14 +#ifndef L__time_mktime
16 + /* Jan 1, 2007 Z - tm = 0,0,0,1,0,107,1,0,0 */
18 +const static time_t new_rule_starts = 1167609600;
23 /**********************************************************************/
24 /* The era code is currently unfinished. */
25 /* #define ENABLE_ERA_CODE */
28 __UCLIBC_MUTEX_LOCK(_time_tzlock);
31 + _time_tzset(*timer < new_rule_starts);
33 __time_localtime_tzi(timer, result, _time_tzinfo);
39 - tzset(); /* We'll, let's get this out of the way. */
40 + /* We'll, let's get this out of the way. */
41 + _time_tzset(_time_mktime((struct tm *) timeptr, 0) < new_rule_starts);
46 6, 0, 0, /* Note: overloaded for non-M non-J case... */
48 ',', 'M', '4', '.', '1', '.', '0',
49 - ',', 'M', '1', '0', '.', '5', '.', '0', 0
50 + ',', 'M', '1', '0', '.', '5', '.', '0', 0,
51 + ',', 'M', '3', '.', '2', '.', '0',
52 + ',', 'M', '1', '1', '.', '1', '.', '0', 0
57 #define RANGE (vals + 7)
58 #define RULE (vals + 11 - 1)
59 #define DEFAULT_RULES (vals + 22)
60 +#define DEFAULT_2007_RULES (vals + 38)
62 /* Initialize to UTC. */
64 @@ -1774,6 +1794,11 @@
68 + _time_tzset((time(NULL)) < new_rule_starts);
71 +void _time_tzset(int use_old_rules)
73 register const char *e;
76 @@ -1896,7 +1921,15 @@
77 } else { /* OK, we have dst, so get some rules. */
79 if (!*e) { /* No rules so default to US rules. */
81 + e = use_old_rules ? DEFAULT_RULES : DEFAULT_2007_RULES;
83 + if (e == DEFAULT_RULES)
84 + printf("tzset: Using old rules.\n");
85 + else if (e == DEFAULT_2007_RULES)
86 + printf("tzset: Using new rules\n");
88 + printf("tzset: Using undefined rules\n");
89 +#endif /* DEBUG_TZSET */
97 + _time_tzset (x.tm_year < 2007); /* tm_year was expanded above */
101 days = -719163L + ((long)d)*365 + ((d/4) - (d/100) + (d/400) + p[3] + p[7]);