19#ifndef SBL_SYSTEM_EPOCH_HPP_
20#define SBL_SYSTEM_EPOCH_HPP_
31 if (Port::overflow()) {
40 const uint32_t e1 = epoch_;
41 const uint32_t c = Port::count();
42 const bool pending = Port::overflow();
43 const uint32_t e2 = epoch_;
47 const uint32_t e = (pending && c < 0x80000000u) ? e1 + 1 : e1;
48 return (
static_cast<uint64_t
>(e) << 32) | c;
53 static uint32_t
epoch() {
return epoch_; }
56 static void reset() { epoch_ = 0; }
59 static inline volatile uint32_t epoch_ = 0;
65constexpr uint64_t to_millis(uint64_t count, uint32_t rate) {
66 return (count / rate) * 1000u + ((count % rate) * 1000u) / rate;
static void on_overflow()
static uint64_t count64()
The system layer: execution levels, the control critical section, ring buffers, assertions and the fa...