4#include "../Foundation/PrimitiveTypes.h"
37 [[nodiscard]]
bool operator>(
const Nanoseconds other)
const {
return ns > other.ns; }
38 [[nodiscard]]
bool operator<(
const Nanoseconds other)
const {
return ns < other.ns; }
39 [[nodiscard]]
bool operator==(
const Nanoseconds other)
const {
return ns == other.ns; }
49 [[nodiscard]]
bool operator>(
const Milliseconds other)
const {
return ms > other.ms; }
50 [[nodiscard]]
bool operator<(
const Milliseconds other)
const {
return ms < other.ms; }
51 [[nodiscard]]
bool operator==(
const Milliseconds other)
const {
return ms == other.ms; }
61 [[nodiscard]]
bool operator>(
const Seconds other)
const {
return sec > other.sec; }
62 [[nodiscard]]
bool operator<(
const Seconds other)
const {
return sec < other.sec; }
63 [[nodiscard]]
bool operator==(
const Seconds other)
const {
return sec == other.sec; }
85 [[nodiscard]]
bool operator>(
const Relative other)
const {
return seconds > other.seconds; }
86 [[nodiscard]]
bool operator<(
const Relative other)
const {
return seconds < other.seconds; }
87 [[nodiscard]]
bool operator==(
const Relative other)
const {
return toNanoseconds() == other.toNanoseconds(); }
89 Seconds toSeconds()
const {
return Seconds(
static_cast<int64_t>(seconds + 0.5)); }
90 Nanoseconds toNanoseconds()
const {
return Nanoseconds(
static_cast<int64_t>(seconds * 1e9 + 0.5)); }
91 Milliseconds toMilliseconds()
const {
return Milliseconds(
static_cast<int64_t>(seconds * 1e3 + 0.5)); }
94 Relative(
double seconds) : seconds(seconds) {}
103inline Time::Nanoseconds
operator""_ns(
unsigned long long int ns) {
return Time::Nanoseconds(
static_cast<int64_t>(ns)); }
104inline Time::Milliseconds
operator""_ms(
unsigned long long int ms) {
return Time::Milliseconds(
static_cast<int64_t>(ms)); }
105inline Time::Seconds
operator""_sec(
unsigned long long int sec) {
return Time::Seconds(
static_cast<int64_t>(sec)); }
139 const char* getMonth()
const;
140 const char* getDay()
const;
141 bool isDaylightSaving =
false;
144 friend struct Internal;
unsigned char uint8_t
Platform independent (1) byte unsigned int.
Definition: PrimitiveTypes.h:36
long long int64_t
Platform independent (8) bytes signed int.
Definition: PrimitiveTypes.h:50
unsigned short uint16_t
Platform independent (2) bytes unsigned int.
Definition: PrimitiveTypes.h:37
Holds information on a parsed absolute time from Absolute::parseLocal.
Definition: Time.h:129
Absolute time as realtime or monotonically increasing clock.
Definition: Time.h:114
Absolute offsetBy(Milliseconds other) const
Offset this absolute time with a relative time in milliseconds.
Absolute()
Construct an Absolute time equal to epoch.
Definition: Time.h:121
bool isLaterThanOrEqualTo(Absolute other) const
Check if this Absolute time is later or equal to another Absolute time.
bool isLaterThan(Absolute other) const
Check if this Absolute time is lather than another Absolute time.
Absolute(int64_t milliseconds)
Construct an Absolute from milliseconds since epoch.
Definition: Time.h:125
bool parseUTC(ParseResult &result) const
Parses UTC time to a Parsed structure.
Milliseconds subtractExact(Absolute other) const
Obtains the difference between this time and the other time.
bool parseLocal(ParseResult &result) const
Parses local time to a Parsed structure.
An high resolution time counter.
Definition: Time.h:204
Milliseconds toMilliseconds() const
Converts to Milliseconds.
Relative subtractApproximate(HighResolutionCounter other) const
Subtracts another HighResolutionCounter from this one, returning an approximate Relative.
Relative getRelative() const
Converts to a Relative struct.
Nanoseconds toNanoseconds() const
Converts to Nanoseconds.
HighResolutionCounter offsetBy(Milliseconds ms) const
Returns a HighResolutionCounter offset by a given number of Milliseconds.
Seconds toSeconds() const
Converts to Seconds.
bool isLaterThanOrEqualTo(HighResolutionCounter other) const
Check if this HighResolutionCounter is later or equal to another HighResolutionCounter.
HighResolutionCounter & snap()
Sets HighResolutionCounter to current instant Example:
HighResolutionCounter subtractExact(HighResolutionCounter other) const
Subtracts another HighResolutionCounter from this one, returning a precise HighResolutionCounter.
Type-safe wrapper of uint64 used to represent milliseconds.
Definition: Time.h:44
Represent monotonically increasing time (use Monotonic::now for current time)
Definition: Time.h:180
int64_t getMonotonicMilliseconds() const
Return given time as monotonically incrementing milliseconds.
Definition: Time.h:187
static Monotonic now()
Obtain time according to monotonic clock.
Type-safe wrapper of uint64 used to represent nanoseconds.
Definition: Time.h:32
Represents a realtime clock in milliseconds since epoch (use Realtime::now for current time)
Definition: Time.h:192
static Realtime now()
Obtain time according to realtime clock.
int64_t getMillisecondsSinceEpoch() const
Return given time as milliseconds since epoch.
Definition: Time.h:199
Interval of time represented with 64 bit double precision float.
Definition: Time.h:70
Relative(Milliseconds time)
Construct a Relative from milliseconds.
Definition: Time.h:75
Relative(Seconds time)
Construct a Relative from seconds.
Definition: Time.h:81
Relative()
how many seconds have elapsed in
Definition: Time.h:72
Relative(Nanoseconds time)
Construct a Relative from nanoseconds.
Definition: Time.h:78
Type-safe wrapper of uint64 used to represent seconds.
Definition: Time.h:56