forked from jeffhammond/STREAM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmysecond.c
More file actions
38 lines (30 loc) · 918 Bytes
/
mysecond.c
File metadata and controls
38 lines (30 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* A gettimeofday routine to give access to the wall
clock timer on most UNIX-like systems.
This version defines two entry points -- with
and without appended underscores, so it *should*
automagically link with FORTRAN */
#ifndef _WIN32
# include <sys/time.h>
#else
# define WIN32_LEAN_AND_MEAN
# include <Windows.h>
#endif
double mysecond()
{
/* struct timeval { long tv_sec;
long tv_usec; };
struct timezone { int tz_minuteswest;
int tz_dsttime; }; */
#ifndef _WIN32
struct timeval tp;
struct timezone tzp;
int i;
i = gettimeofday(&tp,&tzp);
return ( (double) tp.tv_sec + (double) tp.tv_usec * 1.e-6 );
#else
__int64 t;
GetSystemTimeAsFileTime((FILETIME*)&t);
return ((double)(t - 116444736000000000LL)) / 10000000.0;
#endif
}
double mysecond_() {return mysecond();}