Plasma Engine  2.0
Loading...
Searching...
No Matches
Time_inl.h
1#pragma once
2
3#include <Foundation/Basics.h>
4
5constexpr PL_ALWAYS_INLINE plTime::plTime(double fTime)
6 : m_fTime(fTime)
7{
8}
9
10constexpr PL_ALWAYS_INLINE float plTime::AsFloatInSeconds() const
11{
12 return static_cast<float>(m_fTime);
13}
14
15constexpr PL_ALWAYS_INLINE double plTime::GetNanoseconds() const
16{
17 return m_fTime * 1000000000.0;
18}
19
20constexpr PL_ALWAYS_INLINE double plTime::GetMicroseconds() const
21{
22 return m_fTime * 1000000.0;
23}
24
25constexpr PL_ALWAYS_INLINE double plTime::GetMilliseconds() const
26{
27 return m_fTime * 1000.0;
28}
29
30constexpr PL_ALWAYS_INLINE double plTime::GetSeconds() const
31{
32 return m_fTime;
33}
34
35constexpr PL_ALWAYS_INLINE double plTime::GetMinutes() const
36{
37 return m_fTime / 60.0;
38}
39
40constexpr PL_ALWAYS_INLINE double plTime::GetHours() const
41{
42 return m_fTime / (60.0 * 60.0);
43}
44
45constexpr PL_ALWAYS_INLINE void plTime::operator-=(const plTime& other)
46{
47 m_fTime -= other.m_fTime;
48}
49
50constexpr PL_ALWAYS_INLINE void plTime::operator+=(const plTime& other)
51{
52 m_fTime += other.m_fTime;
53}
54
55constexpr PL_ALWAYS_INLINE void plTime::operator*=(double fFactor)
56{
57 m_fTime *= fFactor;
58}
59
60constexpr PL_ALWAYS_INLINE void plTime::operator/=(double fFactor)
61{
62 m_fTime /= fFactor;
63}
64
65constexpr PL_ALWAYS_INLINE plTime plTime::operator-() const
66{
67 return plTime(-m_fTime);
68}
69
70constexpr PL_ALWAYS_INLINE plTime plTime::operator-(const plTime& other) const
71{
72 return plTime(m_fTime - other.m_fTime);
73}
74
75constexpr PL_ALWAYS_INLINE plTime plTime::operator+(const plTime& other) const
76{
77 return plTime(m_fTime + other.m_fTime);
78}
79
80constexpr PL_ALWAYS_INLINE plTime operator*(plTime t, double f)
81{
82 return plTime::MakeFromSeconds(t.GetSeconds() * f);
83}
84
85constexpr PL_ALWAYS_INLINE plTime operator*(double f, plTime t)
86{
87 return plTime::MakeFromSeconds(t.GetSeconds() * f);
88}
89
90constexpr PL_ALWAYS_INLINE plTime operator*(plTime f, plTime t)
91{
93}
94
95constexpr PL_ALWAYS_INLINE plTime operator/(plTime t, double f)
96{
97 return plTime::MakeFromSeconds(t.GetSeconds() / f);
98}
99
100constexpr PL_ALWAYS_INLINE plTime operator/(double f, plTime t)
101{
102 return plTime::MakeFromSeconds(f / t.GetSeconds());
103}
104
105constexpr PL_ALWAYS_INLINE plTime operator/(plTime f, plTime t)
106{
108}
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12
constexpr plTime operator-(const plTime &other) const
Returns the difference: "this instance - other".
Definition Time_inl.h:70
constexpr double GetHours() const
Returns the hours value.
Definition Time_inl.h:40
PL_ALWAYS_INLINE constexpr plTime()=default
The default constructor sets the time to zero.
PL_ALWAYS_INLINE static constexpr plTime MakeFromSeconds(double fSeconds)
Creates an instance of plTime that was initialized from seconds.
Definition Time.h:30
constexpr void operator/=(double fFactor)
Divides the time by the given factor.
Definition Time_inl.h:60
constexpr double GetMinutes() const
Returns the minutes value.
Definition Time_inl.h:35
constexpr void operator-=(const plTime &other)
Subtracts the time value of "other" from this instances value.
Definition Time_inl.h:45
constexpr plTime operator+(const plTime &other) const
Returns the sum: "this instance + other".
Definition Time_inl.h:75
constexpr float AsFloatInSeconds() const
Returns the time as a float value (in seconds).
Definition Time_inl.h:10
constexpr void operator+=(const plTime &other)
Adds the time value of "other" to this instances value.
Definition Time_inl.h:50
constexpr double GetNanoseconds() const
Returns the nanoseconds value.
Definition Time_inl.h:15
constexpr double GetMicroseconds() const
Returns the microseconds value.
Definition Time_inl.h:20
constexpr double GetSeconds() const
Returns the seconds value.
Definition Time_inl.h:30
constexpr void operator*=(double fFactor)
Multiplies the time by the given factor.
Definition Time_inl.h:55
constexpr double GetMilliseconds() const
Returns the milliseconds value.
Definition Time_inl.h:25