File tree Expand file tree Collapse file tree 2 files changed +28
-5
lines changed
Expand file tree Collapse file tree 2 files changed +28
-5
lines changed Original file line number Diff line number Diff line change 55 and without appended underscores, so it *should*
66 automagically link with FORTRAN */
77
8- #include <sys/time.h>
8+ #ifndef _WIN32
9+ # include <sys/time.h>
10+ #else
11+ #define WIN32_LEAN_AND_MEAN
12+ # include <Windows.h>
13+ #endif
914
1015double mysecond ()
1116{
@@ -15,12 +20,18 @@ double mysecond()
1520struct timezone { int tz_minuteswest;
1621 int tz_dsttime; }; */
1722
23+ #ifndef _WIN32
1824 struct timeval tp ;
1925 struct timezone tzp ;
2026 int i ;
2127
2228 i = gettimeofday (& tp ,& tzp );
2329 return ( (double ) tp .tv_sec + (double ) tp .tv_usec * 1.e-6 );
30+ #else
31+ __int64 t ;
32+ GetSystemTimeAsFileTime ((FILETIME * )& t );
33+ return ((double )(t - 116444736000000000LL )) / 10000000.0 ;
34+ #endif
2435}
2536
2637double mysecond_ () {return mysecond ();}
Original file line number Diff line number Diff line change 4141/* 5. Absolutely no warranty is expressed or implied. */
4242/*-----------------------------------------------------------------------*/
4343# include <stdio.h>
44- # include <unistd.h>
4544# include <math.h>
4645# include <float.h>
4746# include <limits.h>
47+
48+ #ifndef _WIN32
4849# include <sys/time.h>
50+ # include <unistd.h>
51+ #else
52+ # include <BaseTsd.h> // for SSIZE_T
53+ typedef SSIZE_T ssize_t ;
54+ #define WIN32_LEAN_AND_MEAN
55+ # include <Windows.h>
56+ #endif
4957
5058/*-----------------------------------------------------------------------
5159 * INSTRUCTIONS:
@@ -415,16 +423,20 @@ checktick()
415423/* A gettimeofday routine to give access to the wall
416424 clock timer on most UNIX-like systems. */
417425
418- #include <sys/time.h>
419-
420426double mysecond ()
421427{
428+ #ifndef _WIN32
422429 struct timeval tp ;
423430 struct timezone tzp ;
424431 int i ;
425432
426433 i = gettimeofday (& tp ,& tzp );
427434 return ( (double ) tp .tv_sec + (double ) tp .tv_usec * 1.e-6 );
435+ #else
436+ __int64 t ;
437+ GetSystemTimeAsFileTime ((FILETIME * )& t );
438+ return ((double )(t - 116444736000000000LL )) / 10000000.0 ;
439+ #endif
428440}
429441
430442#ifndef abs
@@ -476,7 +488,7 @@ void checkSTREAMresults ()
476488 epsilon = 1.e-13 ;
477489 }
478490 else {
479- printf ("WEIRD: sizeof(STREAM_TYPE) = %lu \n" ,sizeof (STREAM_TYPE ));
491+ printf ("WEIRD: sizeof(STREAM_TYPE) = %zu \n" ,sizeof (STREAM_TYPE ));
480492 epsilon = 1.e-6 ;
481493 }
482494
You can’t perform that action at this time.
0 commit comments