3 * Copyright (C) Igor Sysoev
7 #include <ngx_config.h>
12 * FreeBSD does not test /etc/localtime change, however, we can workaround it
13 * by calling tzset() with TZ and then without TZ to update timezone.
14 * The trick should work since FreeBSD 2.1.0.
16 * Linux does not test /etc/localtime change in localtime(),
17 * but may stat("/etc/localtime") several times in every strftime(),
18 * therefore we use it to update timezone.
20 * Solaris does not test /etc/TIMEZONE change too and no workaround available.
24 ngx_timezone_update(void)
49 strftime(buf, 4, "%H", t);
56 ngx_localtime(time_t s, ngx_tm_t *tm)
58 #if (NGX_HAVE_LOCALTIME_R)
59 (void) localtime_r(&s, tm);
70 tm->ngx_tm_year += 1900;
75 ngx_libc_localtime(time_t s, struct tm *tm)
77 #if (NGX_HAVE_LOCALTIME_R)
78 (void) localtime_r(&s, tm);
91 ngx_libc_gmtime(time_t s, struct tm *tm)
93 #if (NGX_HAVE_LOCALTIME_R)
94 (void) gmtime_r(&s, tm);