Clock.hpp
Go to the documentation of this file.
1 // @formatter:off
2 //
3 // Balau core C++ library
4 //
5 // Copyright (C) 2008 Bora Software (contact@borasoftware.com)
6 //
7 // Licensed under the Boost Software License - Version 1.0 - August 17th, 2003.
8 // See the LICENSE file for the full license text.
9 //
10 
16 
17 #ifndef COM_BORA_SOFTWARE__BALAU_SYSTEM__CLOCK
18 #define COM_BORA_SOFTWARE__BALAU_SYSTEM__CLOCK
19 
20 #include <Balau/ThirdParty/Date/date.hpp>
21 
22 namespace std { // NOLINT
23 
24 namespace chrono {
25 
26 // Missing typedefs.
27 typedef duration<int64_t, centi> centiseconds;
28 typedef duration<int64_t, deci> deciseconds;
29 
30 }
31 
32 }
33 
34 namespace Balau::System {
35 
47 class Clock {
48  public: using TimePoint = std::chrono::system_clock::time_point;
49 
53  public: virtual std::chrono::system_clock::time_point now() const = 0;
54 
58  public: virtual Date::year_month_day today() const = 0;
59 
63  public: virtual std::chrono::nanoseconds nanotime() const = 0;
64 
68  public: virtual std::chrono::milliseconds millitime() const = 0;
69 
73  public: virtual std::chrono::centiseconds centitime() const = 0;
74 
78  public: virtual std::chrono::deciseconds decitime() const = 0;
79 
80  public: virtual ~Clock() = default;
81 };
82 
83 } // namespace Balau::System
84 
85 #endif // COM_BORA_SOFTWARE__BALAU_SYSTEM__CLOCK
Base interface of clocks.
Definition: Clock.hpp:47
STL namespace.
System utilities and wrappers.
Definition: HttpServerConfiguration.hpp:30