dtime_.c
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   /* for HP-UX */
00014 #define _INCLUDE_XOPEN_SOURCE   /* for HP-UX */
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 dtime_(tarray) float *tarray;
00036 #else
00037 dtime_(float *tarray)
00038 #endif
00039 {
00040 #ifdef USE_CLOCK
00041 #ifndef CLOCKS_PER_SECOND
00042 #define CLOCKS_PER_SECOND Hz
00043 #endif
00044         static double t0;
00045         double t = clock();
00046         tarray[1] = 0;
00047         tarray[0] = (t - t0) / CLOCKS_PER_SECOND;
00048         t0 = t;
00049         return tarray[0];
00050 #else
00051         struct tms t;
00052         static struct tms t0;
00053 
00054         times(&t);
00055         tarray[0] = (double)(t.tms_utime - t0.tms_utime) / Hz;
00056         tarray[1] = (double)(t.tms_stime - t0.tms_stime) / Hz;
00057         t0 = t;
00058         return tarray[0] + tarray[1];
00059 #endif
00060         }
00061 #ifdef __cplusplus
00062 }
00063 #endif


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:49