Commit | Line | Data |
---|---|---|
d8875586 MBT |
1 | ?RCS: $Id: d_ftime.U 1 2006-08-24 12:32:52Z rmanfredi $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi | |
4 | ?RCS: | |
5 | ?RCS: You may redistribute only under the terms of the Artistic Licence, | |
6 | ?RCS: as specified in the README file that comes with the distribution. | |
7 | ?RCS: You may reuse parts of this distribution only within the terms of | |
8 | ?RCS: that same Artistic Licence; a copy of which may be found at the root | |
9 | ?RCS: of the source tree for dist 4.0. | |
10 | ?RCS: | |
11 | ?RCS: $Log: d_ftime.U,v $ | |
12 | ?RCS: Revision 3.0 1993/08/18 12:06:06 ram | |
13 | ?RCS: Baseline for dist 3.0 netwide release. | |
14 | ?RCS: | |
15 | ?MAKE:d_ftime d_gettimeod: Inlibc Setvar | |
16 | ?MAKE: -pick add $@ %< | |
17 | ?S:d_ftime: | |
18 | ?S: This variable conditionally defines the HAS_FTIME symbol, which indicates | |
19 | ?S: that the ftime() routine exists. The ftime() routine is basically | |
20 | ?S: a sub-second accuracy clock. | |
21 | ?S:. | |
22 | ?S:d_gettimeod: | |
23 | ?S: This variable conditionally defines the HAS_GETTIMEOFDAY symbol, which | |
24 | ?S: indicates that the gettimeofday() system call exists (to obtain a | |
25 | ?S: sub-second accuracy clock). You should probably include <sys/resource.h>. | |
26 | ?S:. | |
27 | ?C:HAS_FTIME (FTIMER): | |
28 | ?C: This symbol, if defined, indicates that the ftime() routine exists. | |
29 | ?C: It is basically a sub-second accuracy clock, but is less accurate | |
30 | ?C: than gettimeofday(2) anyway. The type "Timeval" should be used to | |
31 | ?C: refer to "struct timeb". | |
32 | ?C:. | |
33 | ?C:HAS_GETTIMEOFDAY (GETTIMEOFDAY): | |
34 | ?C: This symbol, if defined, indicates that the gettimeofday() system | |
35 | ?C: call is available for a sub-second accuracy clock. Usually, the file | |
36 | ?C: <sys/resource.h> needs to be included (see I_SYS_RESOURCE). | |
37 | ?C: The type "Timeval" should be used to refer to "struct timeval". | |
38 | ?C:. | |
39 | ?H:#$d_ftime HAS_FTIME /**/ | |
40 | ?H:#$d_gettimeod HAS_GETTIMEOFDAY /**/ | |
41 | ?H:?%<:@if HAS_FTIME | |
42 | ?H:?%<:#ifdef HAS_FTIME | |
43 | ?H:?%<:#define Timeval struct timeb /* Structure used by ftime() */ | |
44 | ?H:?%<:#endif | |
45 | ?H:?%<:@end | |
46 | ?H:?%<:@if HAS_GETTIMEOFDAY | |
47 | ?H:?%<:#ifdef HAS_GETTIMEOFDAY | |
48 | ?H:?%<:#define Timeval struct timeval /* Structure used by gettimeofday() */ | |
49 | ?H:?%<:#endif | |
50 | ?H:?%<:@end | |
51 | ?H:. | |
52 | ?X:FIXME | |
53 | ?X:?I:?d_ftime:i_systimeb | |
54 | ?X:?I:?d_gettimeod:i_sysresrc | |
55 | ?LINT:set d_gettimeod d_ftime | |
56 | ?LINT:known Timeval | |
57 | : see if gettimeofday or ftime exists | |
58 | ?X: | |
59 | ?X: Give priority to gettimeofday(2) because timing is more accurate | |
60 | ?X: | |
61 | set gettimeofday d_gettimeod | |
62 | eval $inlibc | |
63 | case "$d_gettimeod" in | |
64 | "$undef") | |
65 | set ftime d_ftime | |
66 | eval $inlibc | |
67 | ;; | |
68 | *) | |
69 | val="$undef"; set d_ftime; eval $setvar | |
70 | ;; | |
71 | esac | |
72 | case "$d_gettimeod$d_ftime" in | |
73 | "$undef$undef") | |
74 | echo " " | |
75 | echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4 | |
76 | ;; | |
77 | esac | |
78 |