|
UFO: Alien Invasion
|
Class describing a point of time. More...
#include <DateTime.h>

Public Member Functions | |
| DateTime (int day=0, int second=0) | |
| Construct for DateTime class from date as days and time as seconds. | |
| int | getDateAsDays () const |
| Return the date part of the DateTime as days. | |
| int | getTimeAsSeconds () const |
| Return the time part of the DateTime as seconds. | |
| DateTime & | operator+= (const DateTime &other) |
| Adds a DateTime (duration) to the left DateTime object. | |
| DateTime | operator+ (const DateTime &other) const |
| Calcluate the summary of two DateTime objects in a new one. | |
| DateTime & | operator-= (const DateTime &other) |
| Substracts a DateTime (duration) from the left DateTime object. | |
| DateTime | operator- (const DateTime &other) const |
| Calcluate the difference of two DateTime objects in a new one. | |
| bool | operator== (const DateTime &other) const |
| Decides whether two DateTimes are equal. | |
| bool | operator!= (const DateTime &other) const |
| Decides whether two DateTimes are different. | |
| bool | operator< (const DateTime &other) const |
| Decides if the left DateTime is earlier than the right one. | |
| bool | operator<= (const DateTime &other) const |
| Decides if the left DateTime is earlier or equal to the right one. | |
| bool | operator> (const DateTime &other) const |
| Decides if the left DateTime is later than the right one. | |
| bool | operator>= (const DateTime &other) const |
| Decides if the left DateTime is later or equal to the right one. | |
Static Public Attributes | |
| static const short | SECONDS_PER_MINUTE = 60 |
| static const short | MINUTES_PER_HOUR = 60 |
| static const short | HOURS_PER_DAY = 24 |
| static const int | DAYS_PER_YEAR = 365 |
| static constexpr float | DAYS_PER_YEAR_AVG = 365.25f |
| static const short | MONTHS_PER_YEAR = 12 |
| static const short | SEASONS_PER_YEAR = 4 |
| static const short | SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR |
| static const int | SECONDS_PER_DAY = HOURS_PER_DAY * SECONDS_PER_HOUR |
Protected Member Functions | |
| void | reCalculate (void) |
| Handle over- and underflowing date/time parts. | |
Protected Attributes | |
| int | day |
| int | second |
Class describing a point of time.
Definition at line 30 of file DateTime.h.
Construct for DateTime class from date as days and time as seconds.
Definition at line 34 of file DateTime.cpp.
References day, reCalculate(), and second.
Referenced by operator!=(), operator+(), operator+=(), operator-(), operator-=(), operator<(), operator<=(), operator==(), operator>(), and operator>=().
| int DateTime::getDateAsDays | ( | ) | const |
Return the date part of the DateTime as days.
Definition at line 46 of file DateTime.cpp.
References day.
Referenced by AIR_SaveAircraftXML(), B_GetConstructionTimeRemain(), B_SaveXML(), CP_CampaignRunMarket(), CP_CheckMissionLimitedInTime(), CP_DateConvertLong(), Date_DateToSeconds(), Date_Random(), MIS_SaveXML(), MS_MessageSaveXML(), operator+=(), operator-=(), operator<(), operator==(), operator>(), RS_MarkCollected(), RS_MarkOneResearchable(), and RS_SaveXML().
| int DateTime::getTimeAsSeconds | ( | ) | const |
Return the time part of the DateTime as seconds.
Definition at line 54 of file DateTime.cpp.
References second.
Referenced by AIR_SaveAircraftXML(), B_GetConstructionTimeRemain(), B_SaveXML(), CP_DateConvertLong(), Date_DateToSeconds(), Date_Random(), MIS_SaveXML(), MS_MessageSaveXML(), operator+=(), operator-=(), operator<(), operator==(), operator>(), and RS_SaveXML().
| bool DateTime::operator!= | ( | const DateTime & | other | ) | const |
Decides whether two DateTimes are different.
Definition at line 118 of file DateTime.cpp.
References DateTime().
Calcluate the summary of two DateTime objects in a new one.
| [in] | DateTime& | Reference to the date/time duration to add |
Definition at line 79 of file DateTime.cpp.
References DateTime().
Adds a DateTime (duration) to the left DateTime object.
| [in] | DateTime& | Reference to the date/time duration to add |
Definition at line 66 of file DateTime.cpp.
References DateTime(), day, getDateAsDays(), getTimeAsSeconds(), reCalculate(), and second.
Calcluate the difference of two DateTime objects in a new one.
| [in] | DateTime& | Reference to the date/time duration to substract |
Definition at line 102 of file DateTime.cpp.
References DateTime().
Substracts a DateTime (duration) from the left DateTime object.
| [in] | DateTime& | Reference to the date/time duration to substract |
Definition at line 89 of file DateTime.cpp.
References DateTime(), day, getDateAsDays(), getTimeAsSeconds(), reCalculate(), and second.
| bool DateTime::operator< | ( | const DateTime & | other | ) | const |
Decides if the left DateTime is earlier than the right one.
Definition at line 126 of file DateTime.cpp.
References DateTime(), day, getDateAsDays(), getTimeAsSeconds(), and second.
| bool DateTime::operator<= | ( | const DateTime & | other | ) | const |
Decides if the left DateTime is earlier or equal to the right one.
Definition at line 134 of file DateTime.cpp.
References DateTime().
| bool DateTime::operator== | ( | const DateTime & | other | ) | const |
Decides whether two DateTimes are equal.
Definition at line 110 of file DateTime.cpp.
References DateTime(), day, getDateAsDays(), getTimeAsSeconds(), and second.
| bool DateTime::operator> | ( | const DateTime & | other | ) | const |
Decides if the left DateTime is later than the right one.
Definition at line 142 of file DateTime.cpp.
References DateTime(), day, getDateAsDays(), getTimeAsSeconds(), and second.
| bool DateTime::operator>= | ( | const DateTime & | other | ) | const |
Decides if the left DateTime is later or equal to the right one.
Definition at line 150 of file DateTime.cpp.
References DateTime().
Handle over- and underflowing date/time parts.
Definition at line 160 of file DateTime.cpp.
References day, int(), second, and SECONDS_PER_DAY.
Referenced by DateTime(), operator+=(), and operator-=().
|
protected |
Number of day (starting with 0)
Definition at line 67 of file DateTime.h.
Referenced by DateTime(), getDateAsDays(), operator+=(), operator-=(), operator<(), operator==(), operator>(), and reCalculate().
|
static |
Definition at line 37 of file DateTime.h.
Referenced by CP_DateConvertLong(), CP_ParseCampaign(), uiGeoscapeNode::draw(), and R_Draw3DGlobe().
|
staticconstexpr |
Definition at line 38 of file DateTime.h.
Referenced by GEO_IsNight().
|
static |
Definition at line 36 of file DateTime.h.
|
static |
Definition at line 35 of file DateTime.h.
Referenced by PR_CalculateTotalFrames(), PR_GetProductionHours(), and PR_GetRemainingHours().
|
static |
Definition at line 39 of file DateTime.h.
Referenced by CP_DateConvertLong(), NAT_BackupMonthlyData(), NAT_DrawCharts_f(), NAT_GetFunding(), NAT_ListStats_f(), NAT_LoadXML(), and NAT_SaveXML().
|
static |
Definition at line 40 of file DateTime.h.
Referenced by R_Draw3DGlobe().
|
protected |
Second of the minute
Definition at line 68 of file DateTime.h.
Referenced by DateTime(), getTimeAsSeconds(), operator+=(), operator-=(), operator<(), operator==(), operator>(), and reCalculate().
|
static |
Definition at line 43 of file DateTime.h.
Referenced by B_GetConstructionTimeRemain(), Date_DateToSeconds(), Date_Random(), uiGeoscapeNode::draw(), GEO_IsNight(), R_Draw3DGlobe(), reCalculate(), TEST_F(), and TR_TransferStart().
|
static |
Definition at line 42 of file DateTime.h.
Referenced by AIR_AircraftHasEnoughFuel(), AIR_AircraftHasEnoughFuelOneWay(), AIR_AircraftMakeMove(), AIR_GetOperationRange(), AIR_ParseAircraft(), AIRFIGHT_CampaignRunProjectiles(), AIRFIGHT_ProjectileReachedTarget(), CL_DisplayPopupInterceptMission(), CP_CampaignRun(), CP_DateConvertLong(), CP_ParseCampaign(), CP_SecondConvert(), uiGeoscapeNode::draw(), and GEO_GetAircraftText().
|
static |
Definition at line 34 of file DateTime.h.
Referenced by CP_CampaignRun().