]> sourceware.org Git - newlib-cygwin.git/commitdiff
* hires.h (hires_ns::nsecs): Declare with bool parameter.
authorCorinna Vinschen <corinna@vinschen.de>
Thu, 11 Apr 2013 19:49:58 +0000 (19:49 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Thu, 11 Apr 2013 19:49:58 +0000 (19:49 +0000)
* times.cc (hires_ns::nsecs): Take bool parameter.  If set to true,
don't use prime value (== return system wide absolute value).

winsup/cygwin/ChangeLog
winsup/cygwin/hires.h
winsup/cygwin/times.cc

index 5024aab6f53ef4379cb78d72ab4568bab5a1f289..b6b81eb030e0b4c4dda4529323d62750da1d9fe9 100644 (file)
@@ -1,3 +1,9 @@
+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
index c9a4def381da066ff9017002ece3f5837a7bc3e3..0135a80d4293f26506b11a1e556917b093df5402 100644 (file)
@@ -48,7 +48,7 @@ class hires_ns : public hires_base
   double freq;
   void prime ();
  public:
-  LONGLONG nsecs ();
+  LONGLONG nsecs (bool monotonic = false);
   LONGLONG usecs () {return nsecs () / 1000LL;}
   LONGLONG resolution();
 };
index 764a490764b39092ecefe55aba3220df19a4120c..407f7c479a0ac0b19a66951b6ab125c2d9948a80 100644 (file)
@@ -477,7 +477,7 @@ hires_ns::prime ()
 }
 
 LONGLONG
-hires_ns::nsecs ()
+hires_ns::nsecs (bool monotonic)
 {
   if (!inited)
     prime ();
@@ -495,7 +495,8 @@ hires_ns::nsecs ()
     }
 
   // 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;
 }
 
@@ -642,7 +643,7 @@ clock_gettime (clockid_t clk_id, struct timespec *tp)
 
       case CLOCK_MONOTONIC:
        {
-         LONGLONG now = ntod.nsecs ();
+         LONGLONG now = ntod.nsecs (true);
          if (now == (LONGLONG) -1)
            return -1;
 
This page took 0.033688 seconds and 5 git commands to generate.