1#pragma once
2
3#ifdef NNSDK
4#include <nn/os.h>
5#endif
6
7#include <basis/seadTypes.h>
8#include <time/seadTickSpan.h>
9
10namespace sead
11{
12/// A TickTime represents an instant in time.
13class TickTime
14{
15public:
16 TickTime() { setNow(); }
17
18 u64 toTicks() const { return mTick; }
19
20#ifdef NNSDK
21 void setNow() { mTick = nn::os::GetSystemTick(); }
22#else
23 void setNow();
24#endif
25
26 TickSpan diff(const TickTime& other) const { return s64(mTick - other.mTick); }
27 TickSpan diffToNow() const { return TickTime().diff(other: *this); }
28
29 TickTime& operator+=(const TickSpan& span)
30 {
31 mTick += span.toTicks();
32 return *this;
33 }
34
35 TickTime& operator-=(const TickSpan& span)
36 {
37 mTick -= span.toTicks();
38 return *this;
39 }
40
41private:
42 u64 mTick;
43};
44} // namespace sead
45