Dynare++: MinGW has an implementation of gettimeofday(), no need to provide one
git-svn-id: https://www.dynare.org/svn/dynare/trunk@2944 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
7754e416e4
commit
e83d44a063
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
SystemResources _sysres;
|
SystemResources _sysres;
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
@<|gettimeofday| Win32 implementation@>;
|
|
||||||
@<|sysconf| Win32 implementation@>;
|
@<|sysconf| Win32 implementation@>;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -240,40 +239,6 @@ void Journal::printHeader()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ Taken from list {\tt gdb@@sources.redhat.com}, the author is Danny Smith.
|
|
||||||
|
|
||||||
|_W32_FT_OFFSET| is a time from 1 Jan 1601 to 1 Jan 1970 in 100ns
|
|
||||||
units, and the the |filetime| is taken from {\tt windows.h} file.
|
|
||||||
|
|
||||||
@s filetime int
|
|
||||||
@s __stdcall int
|
|
||||||
@d _W32_FT_OFFSET (116444736000000000LL)
|
|
||||||
@s w32_ftv int
|
|
||||||
|
|
||||||
@<|gettimeofday| Win32 implementation@>=
|
|
||||||
typedef struct _filetime {
|
|
||||||
unsigned long dwLowDateTime;
|
|
||||||
unsigned long dwHighDateTime;
|
|
||||||
} filetime;
|
|
||||||
@#
|
|
||||||
extern "C" {
|
|
||||||
void __stdcall GetSystemTimeAsFileTime(filetime*);
|
|
||||||
};
|
|
||||||
@#
|
|
||||||
typedef union {
|
|
||||||
long long ns100; // time since 1 Jan 1601 in 100ns units
|
|
||||||
filetime ft;
|
|
||||||
} w32_ftv;
|
|
||||||
@#
|
|
||||||
void gettimeofday(struct timeval* p, struct timezone* tz)
|
|
||||||
{
|
|
||||||
w32_ftv _now;
|
|
||||||
GetSystemTimeAsFileTime( &(_now.ft) );
|
|
||||||
p->tv_usec=(long)((_now.ns100 / 10LL) % 1000000LL );
|
|
||||||
p->tv_sec= (long)((_now.ns100-_W32_FT_OFFSET)/10000000LL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ Here we implement |sysconf| for MinGW. We implement only page size,
|
@ Here we implement |sysconf| for MinGW. We implement only page size,
|
||||||
number of physial pages, and a number of available physical pages. The
|
number of physial pages, and a number of available physical pages. The
|
||||||
pagesize is set to 1024 bytes, real pagesize can differ but it is not
|
pagesize is set to 1024 bytes, real pagesize can differ but it is not
|
||||||
|
|
Loading…
Reference in New Issue