1*53ee8cc1Swenshuai.xi /* System-dependent timing definitions. Generic version. 2*53ee8cc1Swenshuai.xi Copyright (C) 1996,1997,1999-2002,2003 Free Software Foundation, Inc. 3*53ee8cc1Swenshuai.xi This file is part of the GNU C Library. 4*53ee8cc1Swenshuai.xi 5*53ee8cc1Swenshuai.xi The GNU C Library is free software; you can redistribute it and/or 6*53ee8cc1Swenshuai.xi modify it under the terms of the GNU Lesser General Public 7*53ee8cc1Swenshuai.xi License as published by the Free Software Foundation; either 8*53ee8cc1Swenshuai.xi version 2.1 of the License, or (at your option) any later version. 9*53ee8cc1Swenshuai.xi 10*53ee8cc1Swenshuai.xi The GNU C Library is distributed in the hope that it will be useful, 11*53ee8cc1Swenshuai.xi but WITHOUT ANY WARRANTY; without even the implied warranty of 12*53ee8cc1Swenshuai.xi MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13*53ee8cc1Swenshuai.xi Lesser General Public License for more details. 14*53ee8cc1Swenshuai.xi 15*53ee8cc1Swenshuai.xi You should have received a copy of the GNU Lesser General Public 16*53ee8cc1Swenshuai.xi License along with the GNU C Library; if not, write to the Free 17*53ee8cc1Swenshuai.xi Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18*53ee8cc1Swenshuai.xi 02111-1307 USA. */ 19*53ee8cc1Swenshuai.xi 20*53ee8cc1Swenshuai.xi /* 21*53ee8cc1Swenshuai.xi * Never include this file directly; use <time.h> instead. 22*53ee8cc1Swenshuai.xi */ 23*53ee8cc1Swenshuai.xi 24*53ee8cc1Swenshuai.xi #ifndef __need_timeval 25*53ee8cc1Swenshuai.xi # ifndef _BITS_TIME_H 26*53ee8cc1Swenshuai.xi # define _BITS_TIME_H 1 27*53ee8cc1Swenshuai.xi 28*53ee8cc1Swenshuai.xi /* ISO/IEC 9899:1990 7.12.1: <time.h> 29*53ee8cc1Swenshuai.xi The macro `CLOCKS_PER_SEC' is the number per second of the value 30*53ee8cc1Swenshuai.xi returned by the `clock' function. */ 31*53ee8cc1Swenshuai.xi /* CAE XSH, Issue 4, Version 2: <time.h> 32*53ee8cc1Swenshuai.xi The value of CLOCKS_PER_SEC is required to be 1 million on all 33*53ee8cc1Swenshuai.xi XSI-conformant systems. */ 34*53ee8cc1Swenshuai.xi # define CLOCKS_PER_SEC 1000000l 35*53ee8cc1Swenshuai.xi 36*53ee8cc1Swenshuai.xi # if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K 37*53ee8cc1Swenshuai.xi /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK 38*53ee8cc1Swenshuai.xi presents the real value for clock ticks per second for the system. */ 39*53ee8cc1Swenshuai.xi # include <bits/types.h> 40*53ee8cc1Swenshuai.xi extern long int __sysconf (int); 41*53ee8cc1Swenshuai.xi # define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */ 42*53ee8cc1Swenshuai.xi # endif 43*53ee8cc1Swenshuai.xi 44*53ee8cc1Swenshuai.xi # ifdef __USE_POSIX199309 45*53ee8cc1Swenshuai.xi /* Identifier for system-wide realtime clock. */ 46*53ee8cc1Swenshuai.xi # define CLOCK_REALTIME 0 47*53ee8cc1Swenshuai.xi /* Monotonic system-wide clock. */ 48*53ee8cc1Swenshuai.xi # define CLOCK_MONOTONIC 1 49*53ee8cc1Swenshuai.xi /* High-resolution timer from the CPU. */ 50*53ee8cc1Swenshuai.xi # define CLOCK_PROCESS_CPUTIME_ID 2 51*53ee8cc1Swenshuai.xi /* Thread-specific CPU-time clock. */ 52*53ee8cc1Swenshuai.xi # define CLOCK_THREAD_CPUTIME_ID 3 53*53ee8cc1Swenshuai.xi 54*53ee8cc1Swenshuai.xi /* Flag to indicate time is absolute. */ 55*53ee8cc1Swenshuai.xi # define TIMER_ABSTIME 1 56*53ee8cc1Swenshuai.xi # endif 57*53ee8cc1Swenshuai.xi 58*53ee8cc1Swenshuai.xi # endif /* bits/time.h */ 59*53ee8cc1Swenshuai.xi #endif 60*53ee8cc1Swenshuai.xi 61*53ee8cc1Swenshuai.xi #ifdef __need_timeval 62*53ee8cc1Swenshuai.xi # undef __need_timeval 63*53ee8cc1Swenshuai.xi # ifndef _STRUCT_TIMEVAL 64*53ee8cc1Swenshuai.xi # define _STRUCT_TIMEVAL 1 65*53ee8cc1Swenshuai.xi # include <bits/types.h> 66*53ee8cc1Swenshuai.xi 67*53ee8cc1Swenshuai.xi /* A time value that is accurate to the nearest 68*53ee8cc1Swenshuai.xi microsecond but also has a range of years. */ 69*53ee8cc1Swenshuai.xi struct timeval 70*53ee8cc1Swenshuai.xi { 71*53ee8cc1Swenshuai.xi __time_t tv_sec; /* Seconds. */ 72*53ee8cc1Swenshuai.xi __suseconds_t tv_usec; /* Microseconds. */ 73*53ee8cc1Swenshuai.xi }; 74*53ee8cc1Swenshuai.xi # endif /* struct timeval */ 75*53ee8cc1Swenshuai.xi #endif /* need timeval */ 76