1#ifndef DECONZ_TIMEREF_H
2#define DECONZ_TIMEREF_H
15#include "deconz/declspec.h"
63inline
bool DECONZ_DLLSPEC isValid(
SteadyTimeRef t) {
return t.ref != 0; }
64inline bool DECONZ_DLLSPEC isValid(SystemTimeRef t) {
return t.ref != 0; }
66inline bool DECONZ_DLLSPEC operator<(SystemTimeRef a, SystemTimeRef b) {
return a.ref < b.ref; }
68inline bool DECONZ_DLLSPEC operator==(SteadyTimeRef a, SteadyTimeRef b) {
return a.ref == b.ref; }
69inline bool DECONZ_DLLSPEC operator!=(SteadyTimeRef a, SteadyTimeRef b) {
return a.ref != b.ref; }
70inline bool DECONZ_DLLSPEC operator<(SteadyTimeRef a, SteadyTimeRef b) {
return a.ref < b.ref; }
71inline bool DECONZ_DLLSPEC operator<=(SteadyTimeRef a, SteadyTimeRef b) {
return a.ref <= b.ref; }
73inline TimeMs DECONZ_DLLSPEC operator-(SteadyTimeRef a, SteadyTimeRef b) { TimeMs res; res.val = a.ref - b.ref;
return res; }
74inline SteadyTimeRef DECONZ_DLLSPEC operator+(SteadyTimeRef a, TimeMs t) {
return SteadyTimeRef{a.ref + t.val}; }
75inline SteadyTimeRef DECONZ_DLLSPEC operator+(SteadyTimeRef a, TimeSeconds t) {
return SteadyTimeRef{a.ref + t.val * 1000}; }
77inline bool DECONZ_DLLSPEC operator<(TimeMs a, TimeMs b) {
return a.val < b.val; }
78inline bool DECONZ_DLLSPEC operator<(TimeSeconds a, TimeSeconds b) {
return a.val < b.val; }
79inline bool DECONZ_DLLSPEC operator<(TimeSeconds a, TimeMs b) {
return a.val * 1000 < b.val; }
80inline bool DECONZ_DLLSPEC operator<(TimeMs a, TimeSeconds b) {
return a.val < b.val * 1000; }
82inline TimeSeconds DECONZ_DLLSPEC operator*(TimeSeconds a,
int factor) { TimeSeconds res; res.val = a.val * factor;
return res; }
83inline TimeMs DECONZ_DLLSPEC operator*(TimeMs a,
int factor) { TimeMs res; res.val = a.val * factor;
return res; }
The deCONZ namespace.
Definition aps.cpp:19
int64_t DECONZ_DLLSPEC msecSinceEpoch()
Returnes milliseconds since Epoch.
Definition timeref.cpp:17
SystemTimeRef DECONZ_DLLSPEC systemTimeRef() noexcept
Returnes a time point reference in system time as milliseconds since Epoch.
Definition timeref.cpp:31
SteadyTimeRef DECONZ_DLLSPEC steadyTimeRef() noexcept
Returnes a time point reference in milliseconds which is monotonic increasing.
Definition timeref.cpp:23
Strong typed milliseconds.
Definition timeref.h:37
Strong typed seconds.
Definition timeref.h:43