* hires.h (hires_base::reset): New function.

(hires_us): Specify that hires_base is a public import.
(hires_ms): Ditto.
* times.cc (gtod): Move earlier in file.
(settimeofday): Reset gtod so that base will be subsequently recalculated.
This commit is contained in:
Christopher Faylor
2010-05-26 14:48:17 +00:00
parent 1ee8d76ca0
commit fca8f35f11
3 changed files with 17 additions and 5 deletions

View File

@@ -28,6 +28,8 @@ details. */
#define FACTOR (0x19db1ded53e8000LL)
#define NSPERSEC 10000000LL
hires_ms NO_COPY gtod;
static inline LONGLONG
systime_ns ()
{
@@ -116,6 +118,7 @@ settimeofday (const struct timeval *tv, const struct timezone *tz)
st.wMilliseconds = tv->tv_usec / 1000;
res = !SetSystemTime (&st);
gtod.reset ();
syscall_printf ("%d = settimeofday (%x, %x)", res, tv, tz);
@@ -146,8 +149,6 @@ totimeval (struct timeval *dst, FILETIME *src, int sub, int flag)
dst->tv_sec = x / (long long) (1e6);
}
hires_ms NO_COPY gtod;
/* FIXME: Make thread safe */
extern "C" int
gettimeofday (struct timeval *tv, void *tzvp)