| 1 |
cnh |
1.1 |
/* |
| 2 |
|
|
//BOP |
| 3 |
|
|
// !ROUTINE: cloc |
| 4 |
|
|
// !INTERFACE: |
| 5 |
|
|
cloc( double *curtim ) |
| 6 |
|
|
*/ |
| 7 |
|
|
#ifdef TARGET_LINUX |
| 8 |
|
|
#undef FORTRAN_MANGLE_TRAILING_UNDERSCORE |
| 9 |
|
|
#else |
| 10 |
|
|
#define FORTRAN_MANGLE_TRAILING_UNDERSCORE |
| 11 |
|
|
#endif |
| 12 |
|
|
#define TIM_USES_GETTIMEOFDAY |
| 13 |
|
|
|
| 14 |
|
|
#ifdef FORTRAN_MANGLE_TRAILING_UNDERSCORE |
| 15 |
|
|
#define procedure_cloc cloc_ |
| 16 |
|
|
#else |
| 17 |
|
|
#define procedure_cloc cloc |
| 18 |
|
|
#endif |
| 19 |
|
|
/* |
| 20 |
|
|
// !DESCRIPTION: |
| 21 |
|
|
// *======================================================* |
| 22 |
|
|
// | cloc( double* timeinsec) |
| 23 |
|
|
// *======================================================* |
| 24 |
|
|
// | Call system time routines and return elapsed time |
| 25 |
|
|
// | in seconds as a 64-bit float. |
| 26 |
|
|
// *======================================================* |
| 27 |
|
|
//EOP |
| 28 |
|
|
*/ |
| 29 |
|
|
#ifdef TIM_USES_OSF_GETCLOCK |
| 30 |
|
|
#include <stdio.h> |
| 31 |
|
|
#include <stdlib.h> |
| 32 |
|
|
#include <unistd.h> |
| 33 |
|
|
#include <assert.h> |
| 34 |
|
|
#include <sys/time.h> |
| 35 |
|
|
void procedure_cloc ( double *curtim ) |
| 36 |
|
|
{ |
| 37 |
|
|
struct timespec tv1; |
| 38 |
|
|
getclock(TIMEOFDAY, &tv1); |
| 39 |
|
|
*curtim = (double)((tv1.tv_nsec)+(tv1.tv_sec)*1.E9); |
| 40 |
|
|
*curtim = *curtim/1E9; |
| 41 |
|
|
} |
| 42 |
|
|
#endif |
| 43 |
|
|
#ifdef TIM_USES_GETTIMEOFDAY |
| 44 |
|
|
#include <stdio.h> |
| 45 |
|
|
#include <stdlib.h> |
| 46 |
|
|
#include <unistd.h> |
| 47 |
|
|
#include <assert.h> |
| 48 |
|
|
#include <sys/time.h> |
| 49 |
|
|
void procedure_cloc ( double *curtim ) |
| 50 |
|
|
{ |
| 51 |
|
|
struct timeval tv1; |
| 52 |
|
|
gettimeofday(&tv1 , (void *)NULL ); |
| 53 |
|
|
*curtim = (double)((tv1.tv_usec)+(tv1.tv_sec)*1.E6); |
| 54 |
|
|
*curtim = *curtim/1.E6; |
| 55 |
|
|
|
| 56 |
|
|
} |
| 57 |
|
|
#endif |
| 58 |
|
|
|