1 ?RCS: $Id: d_ftime.U 1 2006-08-24 12:32:52Z rmanfredi $
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
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.
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.
15 ?MAKE:d_ftime d_gettimeod: Inlibc Setvar
16 ?MAKE: -pick add $@ %<
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.
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>.
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".
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".
39 ?H:#$d_ftime HAS_FTIME /**/
40 ?H:#$d_gettimeod HAS_GETTIMEOFDAY /**/
42 ?H:?%<:#ifdef HAS_FTIME
43 ?H:?%<:#define Timeval struct timeb /* Structure used by ftime() */
46 ?H:?%<:@if HAS_GETTIMEOFDAY
47 ?H:?%<:#ifdef HAS_GETTIMEOFDAY
48 ?H:?%<:#define Timeval struct timeval /* Structure used by gettimeofday() */
53 ?X:?I:?d_ftime:i_systimeb
54 ?X:?I:?d_gettimeod:i_sysresrc
55 ?LINT:set d_gettimeod d_ftime
57 : see if gettimeofday or ftime exists
59 ?X: Give priority to gettimeofday(2) because timing is more accurate
61 set gettimeofday d_gettimeod
63 case "$d_gettimeod" in
69 val="$undef"; set d_ftime; eval $setvar
72 case "$d_gettimeod$d_ftime" in
75 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4