* times.cc (hires_ns::nsecs): Take bool parameter. If set to true,
don't use prime value (== return system wide absolute value).
+2013-04-11 Corinna Vinschen <corinna@vinschen.de>
+
+ * hires.h (hires_ns::nsecs): Declare with bool parameter.
+ * times.cc (hires_ns::nsecs): Take bool parameter. If set to true,
+ don't use prime value (== return system wide absolute value).
+
2013-04-08 Christopher Faylor <me.cygwin2013@cgf.cx>
* cygtls.h (_cygtls::reset_signal_arrived): Actually reset the
double freq;
void prime ();
public:
- LONGLONG nsecs ();
+ LONGLONG nsecs (bool monotonic = false);
LONGLONG usecs () {return nsecs () / 1000LL;}
LONGLONG resolution();
};
}
LONGLONG
-hires_ns::nsecs ()
+hires_ns::nsecs (bool monotonic)
{
if (!inited)
prime ();
}
// FIXME: Use round() here?
- now.QuadPart = (LONGLONG) (freq * (double) (now.QuadPart - primed_pc.QuadPart));
+ now.QuadPart = (LONGLONG) (freq * (double)
+ (now.QuadPart - (monotonic ? 0LL : primed_pc.QuadPart)));
return now.QuadPart;
}
case CLOCK_MONOTONIC:
{
- LONGLONG now = ntod.nsecs ();
+ LONGLONG now = ntod.nsecs (true);
if (now == (LONGLONG) -1)
return -1;