aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/posix_timer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/posix_timer.cc')
-rw-r--r--winsup/cygwin/posix_timer.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/winsup/cygwin/posix_timer.cc b/winsup/cygwin/posix_timer.cc
index a336b2b..4968906 100644
--- a/winsup/cygwin/posix_timer.cc
+++ b/winsup/cygwin/posix_timer.cc
@@ -349,15 +349,27 @@ timer_tracker::settime (int flags, const itimerspec *new_value,
/ (NSPERSEC / NS100PERSEC);
if (flags & TIMER_ABSTIME)
{
- if (clock_id == CLOCK_REALTIME)
- DueTime.QuadPart = ts + FACTOR;
- else /* non-REALTIME clocks require relative DueTime. */
+ switch (clock_id)
{
+ case CLOCK_REALTIME_COARSE:
+ case CLOCK_REALTIME:
+ case CLOCK_REALTIME_ALARM:
+ case CLOCK_TAI:
+ DueTime.QuadPart = ts + FACTOR;
+ /* TAI time is realtime + leap secs. NT timers are on
+ realtime. Subtract leap secs to get the corresponding
+ real due time. Leap secs are always 0 unless CLOCK_TAI. */
+ DueTime.QuadPart -= get_clock (clock_id)->get_leap_secs ()
+ * NS100PERSEC;
+ break;
+ default:
+ /* non-REALTIME clocks require relative DueTime. */
DueTime.QuadPart = get_clock_now () - ts;
/* If the timestamp was earlier than now, compute number
of expirations and offset DueTime to expire immediately. */
if (DueTime.QuadPart >= 0)
DueTime.QuadPart = -1LL;
+ break;
}
}
else