https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=6ed50a68a133e7e0c0d10e328bce94f98944dbe5

commit 6ed50a68a133e7e0c0d10e328bce94f98944dbe5
Author: Corinna Vinschen <[email protected]>
Date:   Mon Jan 21 10:05:13 2019 +0100

    Cygwin: timerfd: settime: fix computing DueTime on non-realtime clocks
    
    Non-CLOCK_REALTIME counters always use a relative DueTime in NtSetTimer.
    However, relative DueTime has to be negative, but the code
    
    Signed-off-by: Corinna Vinschen <[email protected]>

Diff:
---
 winsup/cygwin/timerfd.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/timerfd.cc b/winsup/cygwin/timerfd.cc
index e5c17fb..64836b0 100644
--- a/winsup/cygwin/timerfd.cc
+++ b/winsup/cygwin/timerfd.cc
@@ -532,7 +532,7 @@ timerfd_shared::arm_timer (int flags, const struct 
itimerspec *new_value)
        DueTime.QuadPart = ts + FACTOR;
       else /* non-REALTIME clocks require relative DueTime. */
        {
-         DueTime.QuadPart = ts - get_clock_now ();
+         DueTime.QuadPart = get_clock_now () - ts;
          /* If the timestamp was earlier than now, compute number
             of overruns and offset DueTime to expire immediately. */
          if (DueTime.QuadPart >= 0)

Reply via email to