LSH-Core
Deterministic firmware core for Controllino-based Labo Smart Home nodes
 
Loading...
Searching...
No Matches
time_keeper.hpp
Go to the documentation of this file.
1
21#ifndef LSH_CORE_UTIL_TIME_KEEPER_HPP
22#define LSH_CORE_UTIL_TIME_KEEPER_HPP
23
24#include <stdint.h>
25
27
31namespace timeKeeper
32{
33extern uint32_t now;
34
42inline auto getTime() -> uint32_t
43{
44 return now;
45}
46
50__attribute__((always_inline)) inline void update()
51{
52 now = millis();
53}
54
62inline auto getRealTime() -> uint32_t
63{
64 return millis();
65}
66} // namespace timeKeeper
67
68#endif // LSH_CORE_UTIL_TIME_KEEPER_HPP
Utility namespace that exposes the controller time used by the main loop.
Definition time_keeper.hpp:32
auto getTime() -> uint32_t
Gets the cached timestamp from the last timeKeeper::update() call.
Definition time_keeper.hpp:42
uint32_t now
Cached millis() value refreshed once per main-loop iteration.
Definition time_keeper.cpp:24
__attribute__((always_inline)) inline void update()
Refresh the cached timestamp from millis().
Definition time_keeper.hpp:50
auto getRealTime() -> uint32_t
Gets the current time directly by calling millis().
Definition time_keeper.hpp:62
Internal bridge that imports static profile resources into the library's scope.