vengine  0.1.0
3D graphics engine made with Vulkan
Loading...
Searching...
No Matches
Time.hpp
Go to the documentation of this file.
1///
2/// @file Time.hpp
3/// @brief Class for time management
4/// @namespace myLib
5///
6
7#pragma once
8
9namespace myLib {
10
11 ///
12 /// @class Time
13 /// @brief Class used for time management
14 ///
15 class Time {
16
17 public:
18
19 ///
20 /// @brief Construct a new Time object
21 ///
22 explicit Time(const double seconds) : m_seconds(seconds) {};
23
24 ///
25 /// @brief Transform the time to seconds
26 /// @return int The time in seconds
27 ///
28 [[nodiscard]] int asSeconds() const { return static_cast<int>(m_seconds); };
29
30 ///
31 /// @brief Transform the time to milliseconds
32 /// @return int The time in milliseconds
33 ///
34 [[nodiscard]] int asMilliseconds() const { return static_cast<int>(m_seconds * 1000); }
35
36 ///
37 /// @brief Transform the time to microseconds
38 /// @return int The time in microseconds
39 ///
40 [[nodiscard]] int asMicroseconds() const { return static_cast<int>(m_seconds * 1000000); };
41
42 private:
43
44 ///
45 /// @property The time in seconds
46 ///
47 double m_seconds{0.0F};
48
49 }; // Time
50
51} // namespace myLib
Class used for time management.
Definition Time.hpp:15
int asMicroseconds() const
Transform the time to microseconds.
Definition Time.hpp:40
int asMilliseconds() const
Transform the time to milliseconds.
Definition Time.hpp:34
int asSeconds() const
Transform the time to seconds.
Definition Time.hpp:28
double m_seconds
Definition Time.hpp:47
Time(const double seconds)
Construct a new Time object.
Definition Time.hpp:22