Simple struct representing a point in time.
More...
#include <Clock.hpp>
|
| Time () |
| Construct a new Time at noon of day 0. More...
|
|
| Time (unsigned int hour, unsigned int minute, unsigned int day=0) |
| Creates a new time. More...
|
|
void | addMinutes (unsigned int minutes) |
| Adds the amount of minutes to this time. Wraps hours and days. More...
|
|
void | addHours (unsigned int hours) |
| Adds the number of hours to this time. Wraps days. More...
|
|
bool | operator== (const Time &right) const |
| Checks if two times are the same. Compares days as well unless either day is 0. More...
|
|
bool | operator< (const Time &right) const |
| Checks to see if a given time appears later than the current time. Counts days unless either day is 0. More...
|
|
bool | operator> (const Time &right) const |
| Checks to see if a given time appears earlier than the current time. Counts days unless either day is 0. More...
|
|
|
unsigned int | day |
| Number of days elapsed in game since beginning. Starts at 1. More...
|
|
unsigned int | hour |
| Current hour of the day, in range [0, 23]. More...
|
|
unsigned int | minute |
| Current minute of the hour. In range [0, 59]. More...
|
|
Simple struct representing a point in time.
Definition at line 32 of file Clock.hpp.
◆ Time() [1/2]
core::system::Clock::Time::Time |
( |
| ) |
|
Construct a new Time at noon of day 0.
Definition at line 34 of file Clock.cpp.
◆ Time() [2/2]
core::system::Clock::Time::Time |
( |
unsigned int |
hour, |
|
|
unsigned int |
minute, |
|
|
unsigned int |
day = 0 |
|
) |
| |
Creates a new time.
- Parameters
-
hour | The hour of the time |
minute | The minute of the time |
day | The day of the time. Set to 0 to ignore when comparing times |
Definition at line 39 of file Clock.cpp.
◆ addHours()
void core::system::Clock::Time::addHours |
( |
unsigned int |
hours | ) |
|
Adds the number of hours to this time. Wraps days.
- Parameters
-
hours | The number of hours to add |
Definition at line 51 of file Clock.cpp.
◆ addMinutes()
void core::system::Clock::Time::addMinutes |
( |
unsigned int |
minutes | ) |
|
Adds the amount of minutes to this time. Wraps hours and days.
- Parameters
-
minutes | The number of minutes to add |
Definition at line 44 of file Clock.cpp.
◆ operator<()
bool core::system::Clock::Time::operator< |
( |
const Time & |
right | ) |
const |
Checks to see if a given time appears later than the current time. Counts days unless either day is 0.
- Parameters
-
right | The time to check against |
- Returns
- True if right is later than this time
Definition at line 63 of file Clock.cpp.
◆ operator==()
bool core::system::Clock::Time::operator== |
( |
const Time & |
right | ) |
const |
Checks if two times are the same. Compares days as well unless either day is 0.
- Parameters
-
right | The time to check against |
- Returns
- True if the times are the same, false if different
Definition at line 58 of file Clock.cpp.
◆ operator>()
bool core::system::Clock::Time::operator> |
( |
const Time & |
right | ) |
const |
Checks to see if a given time appears earlier than the current time. Counts days unless either day is 0.
- Parameters
-
right | The time to check against |
- Returns
- True if right is earlier than this time
Definition at line 75 of file Clock.cpp.
◆ operator<<
std::ostream& operator<< |
( |
std::ostream & |
stream, |
|
|
const Time & |
time |
|
) |
| |
|
friend |
◆ day
unsigned int core::system::Clock::Time::day |
Number of days elapsed in game since beginning. Starts at 1.
Definition at line 34 of file Clock.hpp.
◆ hour
unsigned int core::system::Clock::Time::hour |
Current hour of the day, in range [0, 23].
Definition at line 37 of file Clock.hpp.
◆ minute
unsigned int core::system::Clock::Time::minute |
Current minute of the hour. In range [0, 59].
Definition at line 40 of file Clock.hpp.
The documentation for this struct was generated from the following files: