acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
aaa_time.h
1#pragma once
2
3//
4//template < typename INTEGRAL_TIME_TYPE >
5//class integral_time :
6// public INTEGRAL_TIME_TYPE
7//{
8//public:
9//
10//
11// using BASE_TYPE = typename INTEGRAL_TIME_TYPE::BASE_TYPE;
12//
13//
14// constexpr integral_time(BASE_TYPE itime = {}) : INTEGRAL_TIME_TYPE(itime) {}
15// integral_time(const class time & time) : INTEGRAL_TIME_TYPE(time) {}
16//
17// integral_time(enum_now)
18// {
19//
20// Now();
21//
22// }
23//
24//
25// inline integral_time & Now();
26//
27// static inline integral_time now() { return now_t{}; }
28//
29//
30// inline integral_time elapsed(const integral_time & timeStop = ::now_t{}) const
31// {
32//
33// return typename INTEGRAL_TIME_TYPE::BASE_TYPE(timeStop.m_i - this->m_i);
34//
35// }
36//
37// inline integral_time update_elapsed(const integral_time & timeStop = ::now < INTEGRAL_TIME_TYPE >())
38// {
39//
40// auto elapsed = timeStop - *this;
41//
42// operator=(timeStop);
43//
44// return elapsed;
45//
46// }
47//
48//
49// inline integral_time half() const
50// {
51//
52// return typename INTEGRAL_TIME_TYPE::BASE_TYPE(this->m_i >> 1);
53//
54// }
55//
56//
57// inline ::f64 sawtooth(const integral_time & period)
58// {
59//
60// return (::f64)(elapsed().m_i % period.m_i) / (::f64)period.m_i;
61//
62// }
63//
64//
65// inline ::f64 period_rate(const integral_time & period)
66// {
67//
68// return (::f64)(elapsed().m_i) / (::f64)period.m_i;
69//
70// }
71//
72//
73// inline bool on_off(const integral_time & period) const
74// {
75//
76// return (elapsed().m_i % period.m_i) < period.half().m_i;
77//
78// }
79//
80//
81// inline bool on_off(const integral_time & period, ::f64 dRate) const
82// {
83//
84// return (elapsed().m_i % period.m_i) < period.m_i * dRate;
85//
86// }
87//
88//
89// //inline class ::time wait() const;
90//
91//
92//
93// template < prototype_integral INTEGRAL >
94// integral_time operator %(INTEGRAL integral) const { return typename INTEGRAL_TIME_TYPE::BASE_TYPE(this->m_i % integral); }
95//
96// template < prototype_integral INTEGRAL >
97// integral_time operator /(INTEGRAL integral) const { return typename INTEGRAL_TIME_TYPE::BASE_TYPE(this->m_i / integral); }
98//
99// template < prototype_integral INTEGRAL >
100// integral_time operator *(INTEGRAL integral) const { return typename INTEGRAL_TIME_TYPE::BASE_TYPE(this->m_i * integral); }
101//
102// template < prototype_integral INTEGRAL >
103// integral_time operator +(INTEGRAL integral) const { return typename INTEGRAL_TIME_TYPE::BASE_TYPE(this->m_i + integral); }
104//
105// template < prototype_integral INTEGRAL >
106// integral_time operator -(INTEGRAL integral) const { return typename INTEGRAL_TIME_TYPE::BASE_TYPE(this->m_i - integral); }
107//
108//
109//
110// integral_time operator %(const BASE_TYPE & time) const { return BASE_TYPE(this->m_i % time.m_i); }
111// ::f64 operator /(const BASE_TYPE & time) const { return (::f64)this->m_i / (::f64)time.m_i; }
112// //integral_time operator *(const BASE_TYPE & time) const { return BASE_TYPE(this->m_i * time.m_i); }
113// integral_time operator +(const BASE_TYPE & time) const { return BASE_TYPE(this->m_i + time.m_i); }
114// integral_time operator -(const BASE_TYPE & time) const { return BASE_TYPE(this->m_i - time.m_i); }
115//
116// integral_time operator -() const { return BASE_TYPE(-this->m_i); }
117//
118// //bool operator == (const BASE_TYPE & time) const { return this->m_i == time.m_i; }
119// //::std::strong_ordering operator <=> (const BASE_TYPE & time) const { return this->m_i <=> time.m_i; }
120// //bool operator >= (const BASE_TYPE & time) const { return this->m_i >= time.m_i; }
121// //bool operator < (const BASE_TYPE & time) const { return this->m_i < time.m_i; }
122// //bool operator <= (const BASE_TYPE & time) const { return this->m_i <= time.m_i; }
123// //bool operator != (const BASE_TYPE & time) const { return this->m_i != time.m_i; }
124//
125//
127// // ::std::strong_ordering operator <=> (const integral_time & time) const { return this->m_i <=> time.m_i; }
128// //bool operator >= (const integral_time & time) const { return this->m_i >= time.m_i; }
129// //bool operator < (const integral_time & time) const { return this->m_i < time.m_i; }
130// //bool operator <= (const integral_time & time) const { return this->m_i <= time.m_i; }
131// //bool operator != (const integral_time & time) const { return this->m_i != time.m_i; }
132//
144//
145// //__DURATION_SETUP__(integral_time, m_i);
146//
147// //DECLARE_COMPARISON_WITH_TIME
148// //DECLARE_COMPARISON_WITH_TIME
149//
150//
151//};
152//
153//
154//template < prototype_floating FLOATING, typename INTEGRAL_TIME_TYPE >
155//integral_time < INTEGRAL_TIME_TYPE > operator * (FLOATING floating, const integral_time < INTEGRAL_TIME_TYPE > & integraltime)
156//{
157//
158// return (typename INTEGRAL_TIME_TYPE::BASE_TYPE) (typename INTEGRAL_TIME_TYPE::BASE_TYPE::BASE_TYPE)(floating * integraltime.m_i);
159//
160//}
161//
162//
163//template < prototype_integral INTEGRAL, typename INTEGRAL_TIME_TYPE >
164//integral_time < INTEGRAL_TIME_TYPE > operator * (INTEGRAL integral, const integral_time < INTEGRAL_TIME_TYPE > & integraltime)
165//{
166//
167// return (typename INTEGRAL_TIME_TYPE::BASE_TYPE) (typename INTEGRAL_TIME_TYPE::BASE_TYPE::BASE_TYPE)(integral * integraltime.m_i);
168//
169//}
177//
178//