From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Waldemar Kozaczuk <jwkozac...@gmail.com>
Branch: master

libc: refine how timerfd_* functions handle wall clock jumps

This patch adjusts logic in timerfd::read() to re-arm clock
when clock jumps backwards to the same expiration time point
which is still ahead of us.

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>

---
diff --git a/libc/timerfd.cc b/libc/timerfd.cc
--- a/libc/timerfd.cc
+++ b/libc/timerfd.cc
@@ -205,7 +205,7 @@ int timerfd::read(uio *data, int flags)
                 ret = 1 + count;
             } else {
                 // Clock is REALTIME and now < _expiration (clock may have 
jumped backwards)
-                _wakeup_due = _expiration + _interval;
+                _wakeup_due = _expiration;
                 _wakeup_change_cond.wake_one();
                 goto again;
             }

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/000000000000a17aa605a0ea1e86%40google.com.

Reply via email to