Back to index

glibc  2.9
time.h
Go to the documentation of this file.
00001 /* System-dependent timing definitions.  Generic version.
00002    Copyright (C) 1996,1997,1999-2002,2003 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 /*
00021  * Never include this file directly; use <time.h> instead.
00022  */
00023 
00024 #ifndef __need_timeval
00025 # ifndef _BITS_TIME_H
00026 #  define _BITS_TIME_H      1
00027 
00028 /* ISO/IEC 9899:1990 7.12.1: <time.h>
00029    The macro `CLOCKS_PER_SEC' is the number per second of the value
00030    returned by the `clock' function. */
00031 /* CAE XSH, Issue 4, Version 2: <time.h>
00032    The value of CLOCKS_PER_SEC is required to be 1 million on all
00033    XSI-conformant systems. */
00034 #  define CLOCKS_PER_SEC  1000000l
00035 
00036 #  if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K
00037 /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
00038    presents the real value for clock ticks per second for the system.  */
00039 #   include <bits/types.h>
00040 extern long int __sysconf (int);
00041 #   define CLK_TCK ((__clock_t) __sysconf (2))   /* 2 is _SC_CLK_TCK */
00042 #  endif
00043 
00044 #  ifdef __USE_POSIX199309
00045 /* Identifier for system-wide realtime clock.  */
00046 #   define CLOCK_REALTIME          0
00047 /* Monotonic system-wide clock.  */
00048 #   define CLOCK_MONOTONIC         1
00049 /* High-resolution timer from the CPU.  */
00050 #   define CLOCK_PROCESS_CPUTIME_ID       2
00051 /* Thread-specific CPU-time clock.  */
00052 #   define CLOCK_THREAD_CPUTIME_ID 3
00053 
00054 /* Flag to indicate time is absolute.  */
00055 #   define TIMER_ABSTIME           1
00056 #  endif
00057 
00058 # endif       /* bits/time.h */
00059 #endif
00060 
00061 #ifdef __need_timeval
00062 # undef __need_timeval
00063 # ifndef _STRUCT_TIMEVAL
00064 #  define _STRUCT_TIMEVAL   1
00065 #  include <bits/types.h>
00066 
00067 /* A time value that is accurate to the nearest
00068    microsecond but also has a range of years.  */
00069 struct timeval
00070   {
00071     __time_t tv_sec;        /* Seconds.  */
00072     __suseconds_t tv_usec;  /* Microseconds.  */
00073   };
00074 # endif       /* struct timeval */
00075 #endif /* need timeval */