Go to the documentation of this file.00001 #include "time.h"
00002
00003 #ifdef MSDOS
00004 #undef USE_CLOCK
00005 #define USE_CLOCK
00006 #endif
00007
00008 #ifndef REAL
00009 #define REAL double
00010 #endif
00011
00012 #ifndef USE_CLOCK
00013 #define _INCLUDE_POSIX_SOURCE
00014 #define _INCLUDE_XOPEN_SOURCE
00015 #include "sys/types.h"
00016 #include "sys/times.h"
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020 #endif
00021
00022 #undef Hz
00023 #ifdef CLK_TCK
00024 #define Hz CLK_TCK
00025 #else
00026 #ifdef HZ
00027 #define Hz HZ
00028 #else
00029 #define Hz 60
00030 #endif
00031 #endif
00032
00033 REAL
00034 #ifdef KR_headers
00035 etime_(tarray) float *tarray;
00036 #else
00037 etime_(float *tarray)
00038 #endif
00039 {
00040 #ifdef USE_CLOCK
00041 #ifndef CLOCKS_PER_SECOND
00042 #define CLOCKS_PER_SECOND Hz
00043 #endif
00044 double t = clock();
00045 tarray[1] = 0;
00046 return tarray[0] = t / CLOCKS_PER_SECOND;
00047 #else
00048 struct tms t;
00049
00050 times(&t);
00051 return (tarray[0] = (double)t.tms_utime/Hz)
00052 + (tarray[1] = (double)t.tms_stime/Hz);
00053 #endif
00054 }
00055 #ifdef __cplusplus
00056 }
00057 #endif