/[MITgcm]/MITgcm_contrib/ESMF/interface_test/code/tim.c
ViewVC logotype

Contents of /MITgcm_contrib/ESMF/interface_test/code/tim.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Mon Feb 16 18:57:52 2004 UTC (21 years, 5 months ago) by cnh
Branch: MAIN
CVS Tags: adoption_1_0_pre_A, HEAD
File MIME type: text/plain
Error occurred while calculating annotation data.
Base files needed for simple component build

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

  ViewVC Help
Powered by ViewVC 1.1.22