Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
real-clock.cpp
Go to the documentation of this file.
1/*
2 RealClock - convenience front-end to access the system clock
3
4 Copyright (C)
5 2012, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12* *****************************************************************/
13
14
24#include "vault/real-clock.hpp"
25
26#include <chrono>
27
28
30using std::chrono::steady_clock;
31using std::chrono::microseconds;
32using std::chrono::floor;
33
34namespace vault {
35
36
37
39 const Offset RealClock::CONSIDERED_RECENT{FSecs {1,1000}};
40
41
42 TimeValue
44 {
45 auto now = steady_clock::now();
46 auto microTicks = floor<microseconds> (now.time_since_epoch())
47 .count();
48
49 ENSURE (microTicks == _raw(TimeValue{microTicks}));
50 return TimeValue::buildRaw_(microTicks); // bypassing the limit check
51 }
52
53
54
55} // namespace vault
basic constant internal time value.
static TimeValue buildRaw_(raw_time_64)
Definition time.cpp:268
static TimeValue _readSystemTime()
static Time now()
static const Offset CONSIDERED_RECENT
events during the last ms are considered "recent" for the purpose of testing
boost::rational< int64_t > FSecs
rational representation of fractional seconds
Vault-Layer implementation namespace root.
Front-end for simplified access to the current wall clock time.