forked from sony/nmos-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhealth.h
More file actions
26 lines (20 loc) · 691 Bytes
/
health.h
File metadata and controls
26 lines (20 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef NMOS_HEALTH_H
#define NMOS_HEALTH_H
#include "nmos/tai.h"
namespace nmos
{
// Like version, health is also stored as a timestamp, but only to the nearest second
typedef std::int64_t health;
// some resources may (temporarily or permanently) be exempt from expiration
const health health_forever = (std::numeric_limits<health>::max)();
inline health health_now()
{
return std::chrono::duration_cast<std::chrono::seconds>(
tai_clock::now().time_since_epoch()).count();
}
inline tai_clock::time_point time_point_from_health(health health)
{
return tai_clock::time_point(std::chrono::seconds(health));
}
}
#endif