nxt_time.h (0:a63ceefd6ab0) nxt_time.h (2084:7d479274f334)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_UNIX_TIME_H_INCLUDED_
8#define _NXT_UNIX_TIME_H_INCLUDED_

--- 60 unchanged lines hidden (view full) ---

69 * 5) The "struct tm.tm_isdst" field returned by localtime() indicates
70 * current DST state on all platforms. This field may have three values:
71 * positive means DST in effect, zero means DST is not in effect, and
72 * negative means DST state is unknown.
73 */
74
75#if (NXT_HAVE_TM_GMTOFF)
76
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_UNIX_TIME_H_INCLUDED_
8#define _NXT_UNIX_TIME_H_INCLUDED_

--- 60 unchanged lines hidden (view full) ---

69 * 5) The "struct tm.tm_isdst" field returned by localtime() indicates
70 * current DST state on all platforms. This field may have three values:
71 * positive means DST in effect, zero means DST is not in effect, and
72 * negative means DST state is unknown.
73 */
74
75#if (NXT_HAVE_TM_GMTOFF)
76
77#define \
78nxt_timezone(tm) \
77#define nxt_timezone(tm) \
79 ((tm)->tm_gmtoff)
80
81#elif (NXT_HAVE_ALTZONE)
82
78 ((tm)->tm_gmtoff)
79
80#elif (NXT_HAVE_ALTZONE)
81
83#define \
84nxt_timezone(tm) \
82#define nxt_timezone(tm) \
85 (-(((tm)->tm_isdst > 0) ? altzone : timezone))
86
87#else
88
83 (-(((tm)->tm_isdst > 0) ? altzone : timezone))
84
85#else
86
89#define \
90nxt_timezone(tm) \
87#define nxt_timezone(tm) \
91 (-(((tm)->tm_isdst > 0) ? timezone + 3600 : timezone))
92
93#endif
94
95
96typedef uint32_t nxt_msec_t;
97typedef int32_t nxt_msec_int_t;
98#define NXT_INFINITE_MSEC ((nxt_msec_t) -1)
99
100
101/*
102 * Since nxt_msec_t values are stored just in 32 bits, they overflow
103 * every 49 days. This signed subtraction takes into account that overflow.
104 * "nxt_msec_diff(m1, m2) < 0" means that m1 is lesser than m2.
105 */
88 (-(((tm)->tm_isdst > 0) ? timezone + 3600 : timezone))
89
90#endif
91
92
93typedef uint32_t nxt_msec_t;
94typedef int32_t nxt_msec_int_t;
95#define NXT_INFINITE_MSEC ((nxt_msec_t) -1)
96
97
98/*
99 * Since nxt_msec_t values are stored just in 32 bits, they overflow
100 * every 49 days. This signed subtraction takes into account that overflow.
101 * "nxt_msec_diff(m1, m2) < 0" means that m1 is lesser than m2.
102 */
106#define \
107nxt_msec_diff(m1, m2) \
103#define nxt_msec_diff(m1, m2) \
108 ((int32_t) ((m1) - (m2)))
109
110
111#endif /* _NXT_UNIX_TIME_H_INCLUDED_ */
104 ((int32_t) ((m1) - (m2)))
105
106
107#endif /* _NXT_UNIX_TIME_H_INCLUDED_ */