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

commit 3b1d436c22a99c4230f1fff38cdc9adef21e417c
Author:     Corinna Vinschen <cori...@vinschen.de>
AuthorDate: Wed Jul 16 11:46:02 2025 +0200
Commit:     Corinna Vinschen <cori...@vinschen.de>
CommitDate: Wed Jul 16 12:16:57 2025 +0200

    Cygwin: POSIX timer: handle TIMER_ABSTIME correctly for all realtime clocks
    
    Add CLOCK_REALTIME_COARSE and CLOCK_REALTIME_ALARM to the clocks
    allowing an absolute timeout value to be used as such in NtSetTimer.
    
    Fixes: c05df02725c59 ("Cygwin: implement extensible clock interface")
    Fixes: 013e2bd9ecf85 ("Cygwin: posix timers: Add support for 
CLOCK_REALTIME_ALARM/CLOCK_BOOTTIME_ALARM")
    Signed-off-by: Corinna Vinschen <cori...@vinschen.de>
    
    (cherry picked from commit 2e8c180a837e83e2a37ee68e6b38b40462d5c5d2)

Diff:
---
 winsup/cygwin/posix_timer.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/posix_timer.cc b/winsup/cygwin/posix_timer.cc
index a336b2bc2d59..14694a87dd0f 100644
--- a/winsup/cygwin/posix_timer.cc
+++ b/winsup/cygwin/posix_timer.cc
@@ -349,7 +349,9 @@ timer_tracker::settime (int flags, const itimerspec 
*new_value,
                 / (NSPERSEC / NS100PERSEC);
          if (flags & TIMER_ABSTIME)
            {
-             if (clock_id == CLOCK_REALTIME)
+             if (clock_id == CLOCK_REALTIME_COARSE
+                 || clock_id == CLOCK_REALTIME
+                 || clock_id == CLOCK_REALTIME_ALARM)
                DueTime.QuadPart = ts + FACTOR;
              else /* non-REALTIME clocks require relative DueTime. */
                {

Reply via email to