|
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. More... | |
| int | getDateAsDays () const |
| Return the date part of the DateTime as days. More... | |
| int | getTimeAsSeconds () const |
| Return the time part of the DateTime as seconds. More... | |
| DateTime & | operator+= (const DateTime &other) |
| Adds a DateTime (duration) to the left DateTime object. More... | |
| DateTime | operator+ (const DateTime &other) const |
| Calcluate the summary of two DateTime objects in a new one. More... | |
| DateTime & | operator-= (const DateTime &other) |
| Substracts a DateTime (duration) from the left DateTime object. More... | |
| DateTime | operator- (const DateTime &other) const |
| Calcluate the difference of two DateTime objects in a new one. More... | |
| bool | operator== (const DateTime &other) const |
| Decides whether two DateTimes are equal. More... | |
| bool | operator!= (const DateTime &other) const |
| Decides whether two DateTimes are different. More... | |
| bool | operator< (const DateTime &other) const |
| Decides if the left DateTime is earlier than the right one. More... | |
| bool | operator<= (const DateTime &other) const |
| Decides if the left DateTime is earlier or equal to the right one. More... | |
| bool | operator> (const DateTime &other) const |
| Decides if the left DateTime is later than the right one. More... | |
| bool | operator>= (const DateTime &other) const |
| Decides if the left DateTime is later or equal to the right one. More... | |
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. More... | |
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.
| [in] | day | Absolute number of days |
| [in] | second | Absolute number of seconds |
Definition at line 34 of file DateTime.cpp.
References reCalculate().
Referenced by 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 AB_BaseSearchedByNations(), AIR_SaveAircraftXML(), B_GetConstructionTimeRemain(), B_SaveXML(), CP_CampaignRun(), CP_CampaignRunMarket(), CP_CheckMissionLimitedInTime(), CP_DateConvertLong(), CP_MissionStageEnd(), CP_ReduceXVIEverywhere(), CP_SaveXML(), CreateInstallation(), Date_DateToSeconds(), Date_Random(), GEO_IsNight(), INS_Build(), INS_FillUFOYardData_f(), INS_SelectInstallation(), INS_UpdateInstallationData(), MIS_SaveXML(), MS_MessageSaveXML(), operator+=(), operator-=(), operator<(), operator==(), operator>(), RS_MarkCollected(), RS_MarkOneResearchable(), RS_SaveXML(), TEST_F(), and TR_TransferStart().
| 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_CampaignRun(), CP_DateConvertLong(), CP_MissionStageEnd(), CP_SaveXML(), Date_DateToSeconds(), Date_Random(), GEO_IsNight(), MIS_SaveXML(), MS_MessageSaveXML(), operator+=(), operator-=(), operator<(), operator==(), operator>(), RS_SaveXML(), and TR_TransferStart().
| bool DateTime::operator!= | ( | const DateTime & | other | ) | const |
Decides whether two DateTimes are different.
Definition at line 118 of file DateTime.cpp.
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 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 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 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.
| bool DateTime::operator== | ( | const DateTime & | other | ) | const |
Decides whether two DateTimes are equal.
Definition at line 110 of file DateTime.cpp.
References 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 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.
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 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 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().