acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
aaa_time.h
1// Created by camilo on 2021-10-05 12:31 BRT <3ThomasBorregaardSorensen!![ THE ONE GOD ]
2#pragma once
3
4//
5//template < typename FLOATING_TIME_TYPE >
6//class floating_time :
7// public FLOATING_TIME_TYPE
8//{
9//public:
10//
11//
12// using BASE_DURATION = FLOATING_TIME_TYPE;
13// using BASE_TYPE = typename BASE_DURATION::BASE_TYPE;
14//
15//
16// constexpr floating_time(BASE_TYPE t = {}) : FLOATING_TIME_TYPE(t) {}
17// floating_time(const class time & time) : FLOATING_TIME_TYPE(time) {}
18//
24//
25// floating_time(enum_now)
26// {
27//
28// Now();
29//
30// }
31//
32//
33// inline floating_time elapsed(const floating_time & timeStop = ::now < FLOATING_TIME_TYPE >()) const
34// {
35//
36// return timeStop.m_f64 - this->m_f64;
37//
38// }
39//
40//
41// inline floating_time update_elapsed(const floating_time & timeStop = now_t{})
42// {
43//
44// auto elapsed = timeStop - *this;
45//
46// operator=(timeStop);
47//
48// return elapsed;
49//
50// }
51//
52//
53// inline floating_time half() const
54// {
55//
56// return this->m_f64/ 2.0;
57//
58// }
59//
60//
61// inline ::f64 sawtooth(const floating_time & period)
62// {
63//
64// return fmod(elapsed().m_f64, period.m_f64) / period.m_f64;
65//
66// }
67//
68//
69// inline class floating_time & Now()
70// {
71//
72// return operator=(::now <floating_time>());
73//
74// }
75//
76//
77// inline ::f64 period_rate(const floating_time & period)
78// {
79//
80// return elapsed().m_f64 / period.m_f64;
81//
82// }
83//
84//
85// inline bool on_off(const floating_time & period) const
86// {
87//
88// return fmod(elapsed() , period.m_f64) < half();
89//
90//
91// }
92//
93//
94// inline bool on_off(const floating_time & period, ::f64 dRate) const
95// {
96//
97// return fmod(elapsed().m_f64, period.m_f64) < period.m_f64 * dRate;
98//
99//
100// }
101//
102//
103//
104// template < prototype_floating FLOATING >
105// floating_time operator %(FLOATING floating) const { return typename FLOATING_TIME_TYPE::BASE_TYPE(fmod(this->m_f64, floating)); }
106//
107// template < prototype_floating FLOATING >
108// floating_time operator /(FLOATING floating) const { return typename FLOATING_TIME_TYPE::BASE_TYPE(this->m_f64 / floating); }
109//
110// template < prototype_floating FLOATING >
111// floating_time operator *(FLOATING floating) const { return typename FLOATING_TIME_TYPE::BASE_TYPE(this->m_f64 * floating); }
112//
113// template < prototype_floating FLOATING >
114// floating_time operator +(FLOATING floating) const { return typename FLOATING_TIME_TYPE::BASE_TYPE(this->m_f64 + floating); }
115//
116// template < prototype_floating FLOATING >
117// floating_time operator -(FLOATING floating) const { return typename FLOATING_TIME_TYPE::BASE_TYPE(this->m_f64 - floating); }
118//
119//
120// floating_time operator %(const BASE_TYPE & time) const { return typename FLOATING_TIME_TYPE::BASE_TYPE(fmod(this->m_f64, time.m_f64)); }
121// ::f64 operator /(const BASE_TYPE & time) const { return this->m_f64 / time.m_f64; }
122// // floating_time operator *(const BASE_TYPE & time) const { return BASE_TYPE(this->m_f64 * time.m_f64); }
123// floating_time operator +(const BASE_TYPE & time) const { return typename FLOATING_TIME_TYPE::BASE_TYPE(this->m_f64 + time.m_f64); }
124// floating_time operator -(const BASE_TYPE & time) const { return typename FLOATING_TIME_TYPE::BASE_TYPE(this->m_f64 - time.m_f64); }
125//
126//
127// floating_time operator -() const { return typename FLOATING_TIME_TYPE::BASE_TYPE(-this->m_f64); }
128//
129//
130// //bool operator ==(const BASE_TYPE & time) const { return this->m_f64 == time.m_f64; }
131// //bool operator >(const BASE_TYPE & time) const { return this->m_f64 > time.m_f64; }
132// //bool operator >=(const BASE_TYPE & time) const { return this->m_f64 >= time.m_f64; }
133// //bool operator <(const BASE_TYPE & time) const { return this->m_f64 < time.m_f64; }
134// //bool operator <=(const BASE_TYPE & time) const { return this->m_f64 <= time.m_f64; }
135// //bool operator !=(const BASE_TYPE & time) const { return this->m_f64 != time.m_f64; }
136//
137//
138//
139// //__DURATION_SETUP__(floating_time, m_f64);
140//
141//
142// //DECLARE_COMPARISON_WITH_TIME
143//
144//
145//
146//};
147//
148//
149//