3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Nginx, Inc.
8 #include <ngx_config.h>
13 * FreeBSD does not test /etc/localtime change, however, we can workaround it
14 * by calling tzset() with TZ and then without TZ to update timezone.
15 * The trick should work since FreeBSD 2.1.0.
17 * Linux does not test /etc/localtime change in localtime(),
18 * but may stat("/etc/localtime") several times in every strftime(),
19 * therefore we use it to update timezone.
21 * Solaris does not test /etc/TIMEZONE change too and no workaround available.
25 ngx_timezone_update(void)
50 strftime(buf
, 4, "%H", t
);
57 ngx_localtime(time_t s
, ngx_tm_t
*tm
)
59 #if (NGX_HAVE_LOCALTIME_R)
60 (void) localtime_r(&s
, tm
);
71 tm
->ngx_tm_year
+= 1900;
76 ngx_libc_localtime(time_t s
, struct tm
*tm
)
78 #if (NGX_HAVE_LOCALTIME_R)
79 (void) localtime_r(&s
, tm
);
92 ngx_libc_gmtime(time_t s
, struct tm
*tm
)
94 #if (NGX_HAVE_LOCALTIME_R)
95 (void) gmtime_r(&s
, tm
);