1 |
dimitri |
1.1 |
/* |
2 |
|
|
* $Header: /usr/local/gcmpack/MITgcm/eesupp/src/tim.c,v 1.6 2003/11/11 20:38:26 edhill Exp $ |
3 |
|
|
* $Name: checkpoint52a_post $ |
4 |
|
|
|
5 |
|
|
//BOP |
6 |
|
|
// !ROUTINE: cloc |
7 |
|
|
// !INTERFACE: |
8 |
|
|
cloc( double *curtim ) |
9 |
|
|
*/ |
10 |
|
|
|
11 |
|
|
/* Here, we get the definition of the FC_NAMEMANGLE() macro. */ |
12 |
|
|
#include "FC_NAMEMANGLE.h" |
13 |
|
|
|
14 |
|
|
#define TIM_USES_GETTIMEOFDAY |
15 |
|
|
|
16 |
|
|
/* |
17 |
|
|
// !DESCRIPTION: |
18 |
|
|
// *======================================================* |
19 |
|
|
// | cloc( double* timeinsec) |
20 |
|
|
// *======================================================* |
21 |
|
|
// | Call system time routines and return elapsed time |
22 |
|
|
// | in seconds as a 64-bit float. |
23 |
|
|
// *======================================================* |
24 |
|
|
//EOP |
25 |
|
|
*/ |
26 |
|
|
#ifdef TIM_USES_OSF_GETCLOCK |
27 |
|
|
#include <stdio.h> |
28 |
|
|
#include <stdlib.h> |
29 |
|
|
#include <unistd.h> |
30 |
|
|
#include <assert.h> |
31 |
|
|
#include <sys/time.h> |
32 |
|
|
void procedure_cloc ( double *curtim ) |
33 |
|
|
{ |
34 |
|
|
struct timespec tv1; |
35 |
|
|
getclock(TIMEOFDAY, &tv1); |
36 |
|
|
*curtim = (double)((tv1.tv_nsec)+(tv1.tv_sec)*1.E9); |
37 |
|
|
*curtim = *curtim/1E9; |
38 |
|
|
} |
39 |
|
|
#endif |
40 |
|
|
#ifdef TIM_USES_GETTIMEOFDAY |
41 |
|
|
#include <stdio.h> |
42 |
|
|
#include <stdlib.h> |
43 |
|
|
#include <unistd.h> |
44 |
|
|
#include <assert.h> |
45 |
|
|
#include <sys/time.h> |
46 |
|
|
void FC_NAMEMANGLE(cloc) ( double *curtim ) |
47 |
|
|
{ |
48 |
|
|
struct timeval tv1; |
49 |
|
|
gettimeofday(&tv1 , (void *)NULL ); |
50 |
|
|
*curtim = (double)((tv1.tv_usec)+(tv1.tv_sec)*1.E6); |
51 |
|
|
*curtim = *curtim/1.E6; |
52 |
|
|
|
53 |
|
|
} |
54 |
|
|
#endif |
55 |
|
|
|