LSH-Core
A robust C++ framework for Arduino-based home automation nodes
Loading...
Searching...
No Matches
timeKeeper Namespace Reference

Time utility to keep track of time around the code. More...

Functions

auto getTime () -> const uint32_t &
 Gets the cached timestamp from the last timeKeeper::update() call.
 
 __attribute__ ((always_inline)) inline void update()
 Update stored time to real time.
 
auto getRealTime () -> uint32_t
 Gets the current time directly by calling millis().
 

Variables

uint32_t now = 0U
 Stored time.
 

Detailed Description

Time utility to keep track of time around the code.

Function Documentation

◆ getRealTime()

auto timeKeeper::getRealTime ( ) -> uint32_t
inline

Gets the current time directly by calling millis().

Use this when a fresh, non-cached timestamp is required.

Returns
The current, real-time value from millis().

◆ getTime()

auto timeKeeper::getTime ( ) -> const uint32_t &
inline

Gets the cached timestamp from the last timeKeeper::update() call.

This avoids multiple calls to millis() within the same loop iteration, ensuring consistency.

Returns
The cached time in milliseconds.
Here is the caller graph for this function: