xref: /unit/auto/time (revision 334:4350610c7c77)
1*0Sigor@sysoev.ru
2*0Sigor@sysoev.ru# Copyright (C) Igor Sysoev
3*0Sigor@sysoev.ru# Copyright (C) NGINX, Inc.
4*0Sigor@sysoev.ru
5*0Sigor@sysoev.ru
6*0Sigor@sysoev.ru# Linux 2.6.32 CLOCK_REALTIME_COARSE.
7*0Sigor@sysoev.ru# Linux clock_gettime() is in librt.
8*0Sigor@sysoev.ru
9*0Sigor@sysoev.runxt_feature="Linux clock_gettime(CLOCK_REALTIME_COARSE)"
10*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_CLOCK_REALTIME_COARSE
11*0Sigor@sysoev.runxt_feature_run=yes
12*0Sigor@sysoev.runxt_feature_incs=
13*0Sigor@sysoev.runxt_feature_libs="-lrt"
14*0Sigor@sysoev.runxt_feature_test="#include <time.h>
15*0Sigor@sysoev.ru
16*0Sigor@sysoev.ru                  int main() {
17*0Sigor@sysoev.ru                      struct timespec  ts;
18*0Sigor@sysoev.ru
19*0Sigor@sysoev.ru                      if (clock_gettime(CLOCK_REALTIME_COARSE, &ts) == -1)
20*0Sigor@sysoev.ru                          return 1;
21*0Sigor@sysoev.ru                      return 0;
22*0Sigor@sysoev.ru                  }"
23*0Sigor@sysoev.ru. auto/feature
24*0Sigor@sysoev.ru
25*0Sigor@sysoev.ruif [ $nxt_found = yes ]; then
26*0Sigor@sysoev.ru    NXT_LIBRT=$nxt_feature_libs
27*0Sigor@sysoev.rufi
28*0Sigor@sysoev.ru
29*0Sigor@sysoev.ru
30*0Sigor@sysoev.ru# FreeBSD 7.0 CLOCK_REALTIME_FAST
31*0Sigor@sysoev.ru
32*0Sigor@sysoev.runxt_feature="FreeBSD clock_gettime(CLOCK_REALTIME_FAST)"
33*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_CLOCK_REALTIME_FAST
34*0Sigor@sysoev.runxt_feature_run=yes
35*0Sigor@sysoev.runxt_feature_incs=
36*0Sigor@sysoev.runxt_feature_libs=
37*0Sigor@sysoev.runxt_feature_test="#include <time.h>
38*0Sigor@sysoev.ru
39*0Sigor@sysoev.ru                  int main() {
40*0Sigor@sysoev.ru                      struct timespec  ts;
41*0Sigor@sysoev.ru
42*0Sigor@sysoev.ru                      if (clock_gettime(CLOCK_REALTIME_FAST, &ts) == -1)
43*0Sigor@sysoev.ru                          return 1;
44*0Sigor@sysoev.ru                      return 0;
45*0Sigor@sysoev.ru                  }"
46*0Sigor@sysoev.ru. auto/feature
47*0Sigor@sysoev.ru
48*0Sigor@sysoev.ru
49*0Sigor@sysoev.runxt_feature="clock_gettime(CLOCK_REALTIME)"
50*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_CLOCK_REALTIME
51*0Sigor@sysoev.runxt_feature_run=yes
52*0Sigor@sysoev.runxt_feature_incs=
53*0Sigor@sysoev.runxt_feature_libs=
54*0Sigor@sysoev.runxt_feature_test="#include <time.h>
55*0Sigor@sysoev.ru
56*0Sigor@sysoev.ru                  int main() {
57*0Sigor@sysoev.ru                      struct timespec  ts;
58*0Sigor@sysoev.ru
59*0Sigor@sysoev.ru                      if (clock_gettime(CLOCK_REALTIME, &ts) == -1)
60*0Sigor@sysoev.ru                          return 1;
61*0Sigor@sysoev.ru                      return 0;
62*0Sigor@sysoev.ru                  }"
63*0Sigor@sysoev.ru. auto/feature
64*0Sigor@sysoev.ru
65*0Sigor@sysoev.ru
66*0Sigor@sysoev.ruif [ $nxt_found = no ]; then
67*0Sigor@sysoev.ru
68*0Sigor@sysoev.ru    # Linux and Solaris 10 clock_gettime() are in librt.
69*0Sigor@sysoev.ru
70*0Sigor@sysoev.ru    nxt_feature="clock_gettime(CLOCK_REALTIME) in librt"
71*0Sigor@sysoev.ru    nxt_feature_libs="-lrt"
72*0Sigor@sysoev.ru    . auto/feature
73*0Sigor@sysoev.ru
74*0Sigor@sysoev.ru    if [ $nxt_found = yes ]; then
75*0Sigor@sysoev.ru        NXT_LIBRT=$nxt_feature_libs
76*0Sigor@sysoev.ru    fi
77*0Sigor@sysoev.rufi
78*0Sigor@sysoev.ru
79*0Sigor@sysoev.ru
80*0Sigor@sysoev.ru# Linux 2.6.32 CLOCK_MONOTONIC_COARSE.
81*0Sigor@sysoev.ru# Linux clock_gettime() is in librt.
82*0Sigor@sysoev.ru
83*0Sigor@sysoev.runxt_feature="Linux clock_gettime(CLOCK_MONOTONIC_COARSE)"
84*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_CLOCK_MONOTONIC_COARSE
85*0Sigor@sysoev.runxt_feature_run=yes
86*0Sigor@sysoev.runxt_feature_incs=
87*0Sigor@sysoev.runxt_feature_libs="-lrt"
88*0Sigor@sysoev.runxt_feature_test="#include <time.h>
89*0Sigor@sysoev.ru
90*0Sigor@sysoev.ru                  int main() {
91*0Sigor@sysoev.ru                      struct timespec  ts;
92*0Sigor@sysoev.ru
93*0Sigor@sysoev.ru                      if (clock_gettime(CLOCK_MONOTONIC_COARSE, &ts) == -1)
94*0Sigor@sysoev.ru                          return 1;
95*0Sigor@sysoev.ru                      return 0;
96*0Sigor@sysoev.ru                  }"
97*0Sigor@sysoev.ru. auto/feature
98*0Sigor@sysoev.ru
99*0Sigor@sysoev.ruif [ $nxt_found = yes ]; then
100*0Sigor@sysoev.ru    NXT_LIBRT=$nxt_feature_libs
101*0Sigor@sysoev.rufi
102*0Sigor@sysoev.ru
103*0Sigor@sysoev.ru
104*0Sigor@sysoev.ru# FreeBSD 7.0 CLOCK_MONOTONIC_FAST
105*0Sigor@sysoev.ru
106*0Sigor@sysoev.runxt_feature="FreeBSD clock_gettime(CLOCK_MONOTONIC_FAST)"
107*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_CLOCK_MONOTONIC_FAST
108*0Sigor@sysoev.runxt_feature_run=yes
109*0Sigor@sysoev.runxt_feature_incs=
110*0Sigor@sysoev.runxt_feature_libs=
111*0Sigor@sysoev.runxt_feature_test="#include <time.h>
112*0Sigor@sysoev.ru
113*0Sigor@sysoev.ru                  int main() {
114*0Sigor@sysoev.ru                      struct timespec  ts;
115*0Sigor@sysoev.ru
116*0Sigor@sysoev.ru                      if (clock_gettime(CLOCK_MONOTONIC_FAST, &ts) == -1)
117*0Sigor@sysoev.ru                          return 1;
118*0Sigor@sysoev.ru                      return 0;
119*0Sigor@sysoev.ru                  }"
120*0Sigor@sysoev.ru. auto/feature
121*0Sigor@sysoev.ru
122*0Sigor@sysoev.ru
123*0Sigor@sysoev.runxt_feature="clock_gettime(CLOCK_MONOTONIC)"
124*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_CLOCK_MONOTONIC
125*0Sigor@sysoev.runxt_feature_run=yes
126*0Sigor@sysoev.runxt_feature_incs=
127*0Sigor@sysoev.runxt_feature_libs=
128*0Sigor@sysoev.runxt_feature_test="#include <time.h>
129*0Sigor@sysoev.ru
130*0Sigor@sysoev.ru                  int main() {
131*0Sigor@sysoev.ru                      struct timespec  ts;
132*0Sigor@sysoev.ru
133*0Sigor@sysoev.ru                      if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
134*0Sigor@sysoev.ru                          return 1;
135*0Sigor@sysoev.ru                      return 0;
136*0Sigor@sysoev.ru                  }"
137*0Sigor@sysoev.ru. auto/feature
138*0Sigor@sysoev.ru
139*0Sigor@sysoev.ru
140*0Sigor@sysoev.ruif [ $nxt_found = no ]; then
141*0Sigor@sysoev.ru
142*0Sigor@sysoev.ru    # Linux and Solaris 10 clock_gettime() are in librt.
143*0Sigor@sysoev.ru
144*0Sigor@sysoev.ru    nxt_feature="clock_gettime(CLOCK_MONOTONIC) in librt"
145*0Sigor@sysoev.ru    nxt_feature_libs="-lrt"
146*0Sigor@sysoev.ru    . auto/feature
147*0Sigor@sysoev.ru
148*0Sigor@sysoev.ru    if [ $nxt_found = yes ]; then
149*0Sigor@sysoev.ru        NXT_LIBRT=$nxt_feature_libs
150*0Sigor@sysoev.ru    fi
151*0Sigor@sysoev.rufi
152*0Sigor@sysoev.ru
153*0Sigor@sysoev.ru
154*0Sigor@sysoev.ru# HP-UX Mercury Library hg_gethrtime().
155*0Sigor@sysoev.ru
156*0Sigor@sysoev.ruNXT_LIBHG=
157*0Sigor@sysoev.ru
158*0Sigor@sysoev.runxt_feature="HP-UX hg_gethrtime()"
159*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_HG_GETHRTIME
160*0Sigor@sysoev.runxt_feature_run=yes
161*0Sigor@sysoev.runxt_feature_incs=
162*0Sigor@sysoev.runxt_feature_libs="-lhg"
163*0Sigor@sysoev.runxt_feature_test="#include <stdlib.h>
164*0Sigor@sysoev.ru                  #include <sys/mercury.h>
165*0Sigor@sysoev.ru
166*0Sigor@sysoev.ru                  int main() {
167*0Sigor@sysoev.ru                      hg_gethrtime();
168*0Sigor@sysoev.ru                      return 0;
169*0Sigor@sysoev.ru                  }"
170*0Sigor@sysoev.ru. auto/feature
171*0Sigor@sysoev.ru
172*0Sigor@sysoev.ruif [ $nxt_found = yes ]; then
173*0Sigor@sysoev.ru    NXT_LIBHG=$nxt_feature_libs
174*0Sigor@sysoev.rufi
175*0Sigor@sysoev.ru
176*0Sigor@sysoev.ru
177*0Sigor@sysoev.runxt_feature="struct tm.tm_gmtoff"
178*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_TM_GMTOFF
179*0Sigor@sysoev.runxt_feature_run=
180*0Sigor@sysoev.runxt_feature_incs=
181*0Sigor@sysoev.runxt_feature_libs=
182*0Sigor@sysoev.runxt_feature_test="#include <time.h>
183*0Sigor@sysoev.ru
184*0Sigor@sysoev.ru                  int main() {
185*0Sigor@sysoev.ru                      time_t     t;
186*0Sigor@sysoev.ru                      struct tm  tm;
187*0Sigor@sysoev.ru
188*0Sigor@sysoev.ru                      t = 0;
189*0Sigor@sysoev.ru                      localtime_r(&t, &tm);
190*0Sigor@sysoev.ru                      return tm.tm_gmtoff;
191*0Sigor@sysoev.ru                  }"
192*0Sigor@sysoev.ru. auto/feature
193*0Sigor@sysoev.ru
194*0Sigor@sysoev.ru
195*0Sigor@sysoev.runxt_feature="altzone"
196*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_ALTZONE
197*0Sigor@sysoev.runxt_feature_run=
198*0Sigor@sysoev.runxt_feature_incs=
199*0Sigor@sysoev.runxt_feature_libs=
200*0Sigor@sysoev.runxt_feature_test="#include <time.h>
201*0Sigor@sysoev.ru
202*0Sigor@sysoev.ru                  int main() {
203*0Sigor@sysoev.ru                      altzone = 0;
204*0Sigor@sysoev.ru                      return 0;
205*0Sigor@sysoev.ru                  }"
206*0Sigor@sysoev.ru. auto/feature
207*0Sigor@sysoev.ru
208*0Sigor@sysoev.ru
209*0Sigor@sysoev.runxt_feature="localtime_r()"
210*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_LOCALTIME_R
211*0Sigor@sysoev.runxt_feature_run=
212*0Sigor@sysoev.runxt_feature_incs=
213*0Sigor@sysoev.runxt_feature_libs=
214*0Sigor@sysoev.runxt_feature_test="#include <time.h>
215*0Sigor@sysoev.ru
216*0Sigor@sysoev.ru                  int main() {
217*0Sigor@sysoev.ru                      time_t     t;
218*0Sigor@sysoev.ru                      struct tm  tm;
219*0Sigor@sysoev.ru
220*0Sigor@sysoev.ru                      t = 0;
221*0Sigor@sysoev.ru                      localtime_r(&t, &tm);
222*0Sigor@sysoev.ru                      return 0;
223*0Sigor@sysoev.ru                  }"
224*0Sigor@sysoev.ru. auto/feature
225