aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/FbTime.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/FbTime.hh')
-rw-r--r--src/FbTk/FbTime.hh15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/FbTk/FbTime.hh b/src/FbTk/FbTime.hh
index 2b33dd8..3d80b12 100644
--- a/src/FbTk/FbTime.hh
+++ b/src/FbTk/FbTime.hh
@@ -34,7 +34,7 @@
34 34
35namespace FbTk { 35namespace FbTk {
36 36
37// time in micro-seconds, monotonic increasing 37// time in micro-seconds
38// 38//
39// interesting links: 39// interesting links:
40// 40//
@@ -44,12 +44,17 @@ namespace FbTk {
44namespace FbTime { 44namespace FbTime {
45 45
46 const uint64_t IN_MILLISECONDS = 1000L; 46 const uint64_t IN_MILLISECONDS = 1000L;
47 const uint64_t IN_SECONDS = 1000L * 1000L; 47 const uint64_t IN_SECONDS = 1000L * IN_MILLISECONDS;
48 const uint64_t IN_MINUTES = 60 * IN_SECONDS;
48 49
49 uint64_t now(); 50 uint64_t mono(); // point in time, always monotonic
51 uint64_t system(); // system time, might jump (DST, leap seconds)
50 52
51 // calculates the remaining microseconds up to the next full 'unit' 53 // calculates the remaining microseconds from 'now' up to the
52 uint64_t remainingNext(uint64_t unit); 54 // next full 'unit'
55 inline uint64_t remainingNext(uint64_t now, uint64_t unit) {
56 return (unit - (now % unit) - 1);
57 }
53 58
54} // namespace FbTime 59} // namespace FbTime
55 60