acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
_time.h
1
// Created by camilo on 2021-10-05 12:52 BRT <3ThomasBorregaardSorensen!![ THE ONE GOD ]
2
#pragma once
3
4
5
template
<
typename
DURATION >
6
inline
DURATION now()
7
{
8
9
throw
"interface_only"
;
10
11
return
now_t
{};
12
13
}
14
15
16
#include "acme/prototype/time/integral/_.h"
17
18
19
#include "acme/prototype/time/floating/_.h"
20
21
22
#include "acme/prototype/time/time/_.h"
23
24
25
//template < typename DURATION >
26
//inline integral_time < DURATION > & integral_time < DURATION >::Now()
27
//{
28
//
29
// return this->operator=(::now < integral_time < DURATION > >());
30
//
31
//}
32
33
34
#define DURATION_OPERATOR_SETUP1(TYPE, type, MEMBER) \
35
inline TYPE operator-(const TYPE & t) { return (TYPE)(-t.MEMBER); } \
36
inline ::f64 operator /(const TYPE & t, const class time & time) { return (::f64)t.MEMBER / (::f64)time.type().MEMBER; } \
37
/*integral_time operator *(const BASE_TYPE & time, const class time & time) const { return BASE_TYPE(this->m_i32 * time.m_i32); }*/
\
38
inline TYPE operator +(const TYPE & t, const class time & time) { return TYPE(t.MEMBER + time.type().MEMBER); } \
39
inline TYPE operator -(const TYPE & t, const class time & time) { return TYPE(t.MEMBER - time.type().MEMBER); }
40
41
42
//inline bool operator ==(const TYPE & t1, const TYPE & t2) { return t1.MEMBER == t2.MEMBER; } \
43
//inline ::std::strong_ordering operator <=>(const TYPE & t1, const TYPE & t2) { return ::comparison::order(t1.MEMBER, t2.MEMBER); } \
44
45
46
47
#define INTEGRAL_DURATION_SETUP1(TYPE, type) \
48
DURATION_OPERATOR_SETUP1(TYPE, type, m_i32) \
49
inline TYPE operator %(const TYPE & t, const class time & time) { return TYPE(t.m_i32 % time.type().m_i32); }
50
51
52
#define FLOATING_DURATION_SETUP1(TYPE, type) \
53
DURATION_OPERATOR_SETUP1(TYPE, type, m_f64) \
54
inline TYPE operator %(const TYPE & t, const class time & time) { return TYPE(fmod(t.m_f64, time.type().m_f64)); }
55
56
57
//INTEGRAL_DURATION_SETUP1(integral_nanosecond , integral_nanosecond )
58
//INTEGRAL_DURATION_SETUP1(integral_microsecond , integral_microsecond )
59
//INTEGRAL_DURATION_SETUP1(integral_millisecond , integral_millisecond )
60
//INTEGRAL_DURATION_SETUP1(integral_second , integral_second )
61
//INTEGRAL_DURATION_SETUP1(integral_minute , integral_minute )
62
//INTEGRAL_DURATION_SETUP1(integral_hour , integral_hour )
63
//INTEGRAL_DURATION_SETUP1(integral_day , integral_day )
64
//
65
//
66
//FLOATING_DURATION_SETUP1(floating_nanosecond , floating_nanosecond )
67
//FLOATING_DURATION_SETUP1(floating_microsecond , floating_microsecond )
68
//FLOATING_DURATION_SETUP1(floating_millisecond , floating_millisecond )
69
//FLOATING_DURATION_SETUP1(floating_second , floating_second )
70
//FLOATING_DURATION_SETUP1(floating_minute , floating_minute )
71
//FLOATING_DURATION_SETUP1(floating_hour , floating_hour )
72
//FLOATING_DURATION_SETUP1(floating_day , floating_day )
73
74
75
//__DURATION_SETUP__(integral_nanosecond , m_i32)
76
//__DURATION_SETUP__(integral_microsecond , m_i32)
77
//__DURATION_SETUP__(integral_millisecond , m_i32)
78
//__DURATION_SETUP__(integral_second , m_i32)
79
//__DURATION_SETUP__(integral_minute , m_i32)
80
//__DURATION_SETUP__(integral_hour , m_i32)
81
//__DURATION_SETUP__(integral_day , m_i32)
82
//
83
84
//__DURATION_SETUP__(floating_nanosecond , m_f64)
85
//__DURATION_SETUP__(floating_microsecond , m_f64)
86
//__DURATION_SETUP__(floating_millisecond , m_f64)
87
//__DURATION_SETUP__(floating_second , m_f64)
88
//__DURATION_SETUP__(floating_minute , m_f64)
89
//__DURATION_SETUP__(floating_hour , m_f64)
90
//__DURATION_SETUP__(floating_day , m_f64)
91
92
93
//inline floating_second_t::floating_second_t(const class time & time)
94
//{
95
//
96
// m_f64 = (::f64) time.m_iSecond + ((::f64) time.m_iNanosecond / 1'000'000'000.0);
97
//
98
//}
99
100
//
101
//inline integral_second_t::integral_second_t(const class time & time)
102
//{
103
//
104
// //m_i32 = time.m_iSecond + (time.m_iNanosecond > 500'000'000 ? 1 : 0);
105
//
106
// m_i32 = time.m_iSecond;
107
//
108
//}
now_t
Definition
_structures.h:48
prototype
time
_time.h
Generated by
1.17.0