| 1 | #cxx . . $ `<file>/chrono/datetime.h`/ifndef CHRONO_UTILITIES_DATETIME_H |
| 2 | #define CHRONO_UTILITIES_DATETIME_Hcxx . . $ `chrono/datetime.h:2:9`! |
| 3 | |
| 4 | #include "./timespan.h"cxx . . $ `<file>/chrono/timespan.h`/ |
| 5 | |
| 6 | #include "../misc/flagenumclass.h"cxx . . $ `<file>/misc/flagenumclass.h`/ |
| 7 | |
| 8 | #include <cstdint> |
| 9 | #include <ctime> |
| 10 | #include <limits> |
| 11 | #include <string> |
| 12 | |
| 13 | namespace CppUtilitiescxx . . $ CppUtilities/ { |
| 14 | |
| 15 | /*! |
| 16 | * \brief Specifies the output format. |
| 17 | * \sa DateTime::toString() |
| 18 | */ |
| 19 | enum class DateTimeOutputFormatcxx . . $ CppUtilities/DateTimeOutputFormat# { |
| 20 | DateAndTimecxx . . $ CppUtilities/DateTimeOutputFormat#DateAndTime., /**< date and time */ |
| 21 | DateOnlycxx . . $ CppUtilities/DateTimeOutputFormat#DateOnly., /**< date only */ |
| 22 | TimeOnlycxx . . $ CppUtilities/DateTimeOutputFormat#TimeOnly., /**< time only */ |
| 23 | DateTimeAndWeekdaycxx . . $ CppUtilities/DateTimeOutputFormat#DateTimeAndWeekday., /**< date with weekday and time */ |
| 24 | DateTimeAndShortWeekdaycxx . . $ CppUtilities/DateTimeOutputFormat#DateTimeAndShortWeekday., /**< date with abbreviated weekday and time */ |
| 25 | Isocxx . . $ CppUtilities/DateTimeOutputFormat#Iso., /**< ISO format like DateTime::toIsoString() */ |
| 26 | IsoOmittingDefaultComponentscxx . . $ CppUtilities/DateTimeOutputFormat#IsoOmittingDefaultComponents., /**< ISO format like DateTime::toIsoString() omitting default components, e.g. just "2017" instead of "2017-01-01T00:00:00" */ |
| 27 | }; |
| 28 | |
| 29 | /*! |
| 30 | * \brief Specifies the day of the week. |
| 31 | * \sa DateTime::dayOfWeek() |
| 32 | */ |
| 33 | enum class DayOfWeekcxx . . $ CppUtilities/DayOfWeek# { |
| 34 | Mondaycxx . . $ CppUtilities/DayOfWeek#Monday., /**< Monday */ |
| 35 | Tuesdaycxx . . $ CppUtilities/DayOfWeek#Tuesday., /**< Tuesday */ |
| 36 | Wednesdaycxx . . $ CppUtilities/DayOfWeek#Wednesday., /**< Wednesday */ |
| 37 | Thursdaycxx . . $ CppUtilities/DayOfWeek#Thursday., /**< Thursday */ |
| 38 | Fridaycxx . . $ CppUtilities/DayOfWeek#Friday., /**< Friday */ |
| 39 | Saturdaycxx . . $ CppUtilities/DayOfWeek#Saturday., /**< Saturday */ |
| 40 | Sundaycxx . . $ CppUtilities/DayOfWeek#Sunday. /**< Sunday */ |
| 41 | }; |
| 42 | |
| 43 | /*! |
| 44 | * \brief Specifies the date part. |
| 45 | * \remarks Intended for internal use only. |
| 46 | * \sa DateTime::getDatePart() |
| 47 | */ |
| 48 | enum class DatePartcxx . . $ CppUtilities/DatePart# { |
| 49 | Yearcxx . . $ CppUtilities/DatePart#Year., /**< year */ |
| 50 | Monthcxx . . $ CppUtilities/DatePart#Month., /**< month */ |
| 51 | DayOfYearcxx . . $ CppUtilities/DatePart#DayOfYear., /**< day of year */ |
| 52 | Daycxx . . $ CppUtilities/DatePart#Day. /**< day */ |
| 53 | }; |
| 54 | |
| 55 | class CPP_UTILITIES_EXPORTcxx . . $ `global.h:11:9`! DateTimecxx . . $ CppUtilities/DateTime# { |
| 56 | public: |
| 57 | using TickTypecxx . . $ CppUtilities/DateTime#TickType# = stdcxx . . $ std/::uint64_tcxx . . $ std/uint64_t#; |
| 58 | |
| 59 | explicit constexpr DateTimecxx . . $ CppUtilities/DateTime#DateTime(49f6e7a06ebc5aa8).(); |
| 60 | explicit constexpr DateTimecxx . . $ CppUtilities/DateTime#DateTime(2c44cd906ae4e829).(TickTypecxx . . $ CppUtilities/DateTime#TickType# ticks); |
| 61 | static DateTimecxx . . $ CppUtilities/DateTime# fromDatecxx . . $ CppUtilities/DateTime#fromDate(1d87702ad89c5e62).(int year = 1, int month = 1, int day = 1); |
| 62 | static DateTimecxx . . $ CppUtilities/DateTime# fromTimecxx . . $ CppUtilities/DateTime#fromTime(3ef1c1b624b456c3).(int hour = 0, int minute = 0, int second = 0, double millisecond = 0.0); |
| 63 | static DateTimecxx . . $ CppUtilities/DateTime# fromDateAndTimecxx . . $ CppUtilities/DateTime#fromDateAndTime(aa79afcea2b9ba5).(int year = 1, int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0, double millisecond = 0.0); |
| 64 | static DateTimecxx . . $ CppUtilities/DateTime# fromStringcxx . . $ CppUtilities/DateTime#fromString(8f6aaa1480fe291e).(const stdcxx . . $ std/::stringcxx . . $ std/string# &str); |
| 65 | static DateTimecxx . . $ CppUtilities/DateTime# fromStringcxx . . $ CppUtilities/DateTime#fromString(935e9a342e01659a).(const char *str); |
| 66 | static stdcxx . . $ std/::paircxx . . $ std/pair#<DateTimecxx . . $ CppUtilities/DateTime#, TimeSpancxx . . $ CppUtilities/TimeSpan#> fromIsoStringcxx . . $ CppUtilities/DateTime#fromIsoString(e51b6f1fbe1aec73).(const char *str); |
| 67 | static DateTimecxx . . $ CppUtilities/DateTime# fromIsoStringGmtcxx . . $ CppUtilities/DateTime#fromIsoStringGmt(935e9a342e01659a).(const char *str); |
| 68 | static DateTimecxx . . $ CppUtilities/DateTime# fromIsoStringLocalcxx . . $ CppUtilities/DateTime#fromIsoStringLocal(935e9a342e01659a).(const char *str); |
| 69 | static DateTimecxx . . $ CppUtilities/DateTime# fromTimeStampcxx . . $ CppUtilities/DateTime#fromTimeStamp(481e32044e5fdc05).(stdcxx . . $ std/::time_tcxx . . $ std/time_t# timeStamp); |
| 70 | constexpr static DateTimecxx . . $ CppUtilities/DateTime# fromTimeStampGmtcxx . . $ CppUtilities/DateTime#fromTimeStampGmt(481e32044e5fdc05).(stdcxx . . $ std/::time_tcxx . . $ std/time_t# timeStamp); |
| 71 | template <typename TimePoint> static DateTimecxx . . $ CppUtilities/DateTime# fromChronoTimePointcxx . . $ CppUtilities/DateTime#fromChronoTimePoint(2f2ebadf2a7535f3).(TimePoint timePoint); |
| 72 | template <typename TimePoint> constexpr static DateTimecxx . . $ CppUtilities/DateTime# fromChronoTimePointGmtcxx . . $ CppUtilities/DateTime#fromChronoTimePointGmt(2f2ebadf2a7535f3).(TimePoint timePoint); |
| 73 | |
| 74 | constexpr TickTypecxx . . $ CppUtilities/DateTime#TickType# &tickscxx . . $ CppUtilities/DateTime#ticks(57d5fc8cf5ed7aa5).(); |
| 75 | constexpr TickTypecxx . . $ CppUtilities/DateTime#TickType# totalTickscxx . . $ CppUtilities/DateTime#totalTicks(fe4d2d262d4164a8).() const; |
| 76 | int yearcxx . . $ CppUtilities/DateTime#year(455f465bc33b4cdf).() const; |
| 77 | int monthcxx . . $ CppUtilities/DateTime#month(455f465bc33b4cdf).() const; |
| 78 | int daycxx . . $ CppUtilities/DateTime#day(455f465bc33b4cdf).() const; |
| 79 | int dayOfYearcxx . . $ CppUtilities/DateTime#dayOfYear(455f465bc33b4cdf).() const; |
| 80 | constexpr DayOfWeekcxx . . $ CppUtilities/DayOfWeek# dayOfWeekcxx . . $ CppUtilities/DateTime#dayOfWeek(d50da9aa82afe8a1).() const; |
| 81 | constexpr int hourcxx . . $ CppUtilities/DateTime#hour(455f465bc33b4cdf).() const; |
| 82 | constexpr int minutecxx . . $ CppUtilities/DateTime#minute(455f465bc33b4cdf).() const; |
| 83 | constexpr int secondcxx . . $ CppUtilities/DateTime#second(455f465bc33b4cdf).() const; |
| 84 | constexpr int millisecondcxx . . $ CppUtilities/DateTime#millisecond(455f465bc33b4cdf).() const; |
| 85 | constexpr int microsecondcxx . . $ CppUtilities/DateTime#microsecond(455f465bc33b4cdf).() const; |
| 86 | constexpr int nanosecondcxx . . $ CppUtilities/DateTime#nanosecond(455f465bc33b4cdf).() const; |
| 87 | constexpr bool isNullcxx . . $ CppUtilities/DateTime#isNull(50ce9a9e25b4a850).() const; |
| 88 | constexpr TimeSpancxx . . $ CppUtilities/TimeSpan# timeOfDaycxx . . $ CppUtilities/DateTime#timeOfDay(af1383a2c4e36306).() const; |
| 89 | bool isLeapYearcxx . . $ CppUtilities/DateTime#isLeapYear(50ce9a9e25b4a850).() const; |
| 90 | constexpr bool isEternitycxx . . $ CppUtilities/DateTime#isEternity(50ce9a9e25b4a850).() const; |
| 91 | constexpr bool isSameDaycxx . . $ CppUtilities/DateTime#isSameDay(1665eba9cd91ac19).(const DateTimecxx . . $ CppUtilities/DateTime# &other) const; |
| 92 | stdcxx . . $ std/::stringcxx . . $ std/string# toStringcxx . . $ CppUtilities/DateTime#toString(ae2e5394ab87f360).(DateTimeOutputFormatcxx . . $ CppUtilities/DateTimeOutputFormat# format = DateTimeOutputFormatcxx . . $ CppUtilities/DateTimeOutputFormat#::DateAndTimecxx . . $ CppUtilities/DateTimeOutputFormat#DateAndTime., bool noMilliseconds = false) const; |
| 93 | void toStringcxx . . $ CppUtilities/DateTime#toString(dc9785426bdd7430).(stdcxx . . $ std/::stringcxx . . $ std/string# &result, DateTimeOutputFormatcxx . . $ CppUtilities/DateTimeOutputFormat# format = DateTimeOutputFormatcxx . . $ CppUtilities/DateTimeOutputFormat#::DateAndTimecxx . . $ CppUtilities/DateTimeOutputFormat#DateAndTime., bool noMilliseconds = false) const; |
| 94 | stdcxx . . $ std/::stringcxx . . $ std/string# toIsoStringWithCustomDelimiterscxx . . $ CppUtilities/DateTime#toIsoStringWithCustomDelimiters(44f5e9ca7d10a61f).( |
| 95 | TimeSpancxx . . $ CppUtilities/TimeSpan# timeZoneDelta = TimeSpancxx . . $ CppUtilities/TimeSpan#TimeSpan(49f6e7a06ebc5aa8).(), char dateDelimiter = '-', char timeDelimiter = ':', char timeZoneDelimiter = ':') const; |
| 96 | stdcxx . . $ std/::stringcxx . . $ std/string# toIsoStringcxx . . $ CppUtilities/DateTime#toIsoString(e6f522c1ca4180f0).(TimeSpancxx . . $ CppUtilities/TimeSpan# timeZoneDelta = TimeSpancxx . . $ CppUtilities/TimeSpan#()) const; |
| 97 | constexpr stdcxx . . $ std/::time_tcxx . . $ std/time_t# toTimeStampcxx . . $ CppUtilities/DateTime#toTimeStamp(57a65ae535d7db84).() const; |
| 98 | static const char *printDayOfWeekcxx . . $ CppUtilities/DateTime#printDayOfWeek(6bdfb5cd057db062).(DayOfWeekcxx . . $ CppUtilities/DayOfWeek# dayOfWeek, bool abbreviation = false); |
| 99 | |
| 100 | static constexpr DateTimecxx . . $ CppUtilities/DateTime# eternitycxx . . $ CppUtilities/DateTime#eternity(3a8d563d7eabf3e1).(); |
| 101 | static constexpr DateTimecxx . . $ CppUtilities/DateTime# unixEpochStartcxx . . $ CppUtilities/DateTime#unixEpochStart(3a8d563d7eabf3e1).(); |
| 102 | static DateTimecxx . . $ CppUtilities/DateTime# nowcxx . . $ CppUtilities/DateTime#now(3a8d563d7eabf3e1).(); |
| 103 | static DateTimecxx . . $ CppUtilities/DateTime# gmtNowcxx . . $ CppUtilities/DateTime#gmtNow(3a8d563d7eabf3e1).(); |
| 104 | static DateTimecxx . . $ CppUtilities/DateTime# exactGmtNowcxx . . $ CppUtilities/DateTime#exactGmtNow(3a8d563d7eabf3e1).(); |
| 105 | constexpr static bool isLeapYearcxx . . $ CppUtilities/DateTime#isLeapYear(83c267b20bac841a).(int year); |
| 106 | static int daysInMonthcxx . . $ CppUtilities/DateTime#daysInMonth(9b79fb6aee4c0440).(int year, int month); |
| 107 | |
| 108 | constexpr bool operatorcxx . . $ CppUtilities/DateTime#`operator==`(1665eba9cd91ac19).==(const DateTimecxx . . $ CppUtilities/DateTime# &other) const; |
| 109 | constexpr bool operatorcxx . . $ CppUtilities/DateTime#`operator!=`(1665eba9cd91ac19).!=(const DateTimecxx . . $ CppUtilities/DateTime# &other) const; |
| 110 | constexpr bool operatorcxx . . $ CppUtilities/DateTime#`operator<`(1665eba9cd91ac19).<(const DateTimecxx . . $ CppUtilities/DateTime# &other) const; |
| 111 | constexpr bool operatorcxx . . $ CppUtilities/DateTime#`operator>`(1665eba9cd91ac19).>(const DateTimecxx . . $ CppUtilities/DateTime# &other) const; |
| 112 | constexpr bool operatorcxx . . $ CppUtilities/DateTime#`operator<=`(1665eba9cd91ac19).<=(const DateTimecxx . . $ CppUtilities/DateTime# &other) const; |
| 113 | constexpr bool operatorcxx . . $ CppUtilities/DateTime#`operator>=`(1665eba9cd91ac19).>=(const DateTimecxx . . $ CppUtilities/DateTime# &other) const; |
| 114 | constexpr DateTimecxx . . $ CppUtilities/DateTime# operatorcxx . . $ CppUtilities/DateTime#operator+(c80c8e835accff8).+(const TimeSpancxx . . $ CppUtilities/TimeSpan# &timeSpan) const; |
| 115 | constexpr DateTimecxx . . $ CppUtilities/DateTime# operatorcxx . . $ CppUtilities/DateTime#operator-(c80c8e835accff8).-(const TimeSpancxx . . $ CppUtilities/TimeSpan# &timeSpan) const; |
| 116 | constexpr TimeSpancxx . . $ CppUtilities/TimeSpan# operatorcxx . . $ CppUtilities/DateTime#operator+(4af8d3bed6a52170).+(const DateTimecxx . . $ CppUtilities/DateTime# &other) const; |
| 117 | constexpr TimeSpancxx . . $ CppUtilities/TimeSpan# operatorcxx . . $ CppUtilities/DateTime#operator-(4af8d3bed6a52170).-(const DateTimecxx . . $ CppUtilities/DateTime# &other) const; |
| 118 | DateTimecxx . . $ CppUtilities/DateTime# &operatorcxx . . $ CppUtilities/DateTime#`operator+=`(5f92a35c43125233).+=(const TimeSpancxx . . $ CppUtilities/TimeSpan# &timeSpan); |
| 119 | DateTimecxx . . $ CppUtilities/DateTime# &operatorcxx . . $ CppUtilities/DateTime#`operator-=`(5f92a35c43125233).-=(const TimeSpancxx . . $ CppUtilities/TimeSpan# &timeSpan); |
| 120 | |
| 121 | private: |
| 122 | static TickTypecxx . . $ CppUtilities/DateTime#TickType# dateToTickscxx . . $ CppUtilities/DateTime#dateToTicks(840af37b591364d5).(int year, int month, int day); |
| 123 | static TickTypecxx . . $ CppUtilities/DateTime#TickType# timeToTickscxx . . $ CppUtilities/DateTime#timeToTicks(c67881ab8ac3a9c7).(int hour, int minute, int second, double millisecond); |
| 124 | int getDatePartcxx . . $ CppUtilities/DateTime#getDatePart(702a50be8cbce955).(DatePartcxx . . $ CppUtilities/DatePart# part) const; |
| 125 | |
| 126 | TickTypecxx . . $ CppUtilities/DateTime#TickType# m_tickscxx . . $ CppUtilities/DateTime#m_ticks.; |
| 127 | static const int m_daysPerYearcxx . . $ CppUtilities/DateTime#m_daysPerYear.; |
| 128 | static const int m_daysPer4Yearscxx . . $ CppUtilities/DateTime#m_daysPer4Years.; |
| 129 | static const int m_daysPer100Yearscxx . . $ CppUtilities/DateTime#m_daysPer100Years.; |
| 130 | static const int m_daysPer400Yearscxx . . $ CppUtilities/DateTime#m_daysPer400Years.; |
| 131 | static const int m_daysTo1601cxx . . $ CppUtilities/DateTime#m_daysTo1601.; |
| 132 | static const int m_daysTo1899cxx . . $ CppUtilities/DateTime#m_daysTo1899.; |
| 133 | static const int m_daysTo10000cxx . . $ CppUtilities/DateTime#m_daysTo10000.; |
| 134 | static const int m_daysToMonth365cxx . . $ CppUtilities/DateTime#m_daysToMonth365.[13]; |
| 135 | static const int m_daysToMonth366cxx . . $ CppUtilities/DateTime#m_daysToMonth366.[13]; |
| 136 | static const int m_daysInMonth365cxx . . $ CppUtilities/DateTime#m_daysInMonth365.[12]; |
| 137 | static const int m_daysInMonth366cxx . . $ CppUtilities/DateTime#m_daysInMonth366.[12]; |
| 138 | }; |
| 139 | |
| 140 | /*! |
| 141 | * \brief The DateTimeParts enum specifies which parts of a timestamp are present. |
| 142 | */ |
| 143 | enum class DateTimePartscxx . . $ CppUtilities/DateTimeParts# : stdcxx . . $ std/::uint64_tcxx . . $ std/uint64_t# { |
| 144 | Nonecxx . . $ CppUtilities/DateTimeParts#None. = 0, /**< no parts are present */ |
| 145 | Yearcxx . . $ CppUtilities/DateTimeParts#Year. = (1 << 0), /**< the year is present */ |
| 146 | Monthcxx . . $ CppUtilities/DateTimeParts#Month. = (1 << 1), /**< the month is present */ |
| 147 | Daycxx . . $ CppUtilities/DateTimeParts#Day. = (1 << 2), /**< the day is present */ |
| 148 | Hourcxx . . $ CppUtilities/DateTimeParts#Hour. = (1 << 3), /**< the hour is present */ |
| 149 | Minutecxx . . $ CppUtilities/DateTimeParts#Minute. = (1 << 4), /**< the minute is present */ |
| 150 | Secondcxx . . $ CppUtilities/DateTimeParts#Second. = (1 << 5), /**< the second is present */ |
| 151 | SubSecondcxx . . $ CppUtilities/DateTimeParts#SubSecond. = (1 << 6), /**< the second contains a fractional part */ |
| 152 | DeltaHourcxx . . $ CppUtilities/DateTimeParts#DeltaHour. = (1 << 7), /**< the timezone-delta hour is present */ |
| 153 | DeltaMinutecxx . . $ CppUtilities/DateTimeParts#DeltaMinute. = (1 << 8), /**< the timezone-delta minute is present */ |
| 154 | Datecxx . . $ CppUtilities/DateTimeParts#Date. = Yearcxx . . $ CppUtilities/DateTimeParts#Year. | Monthcxx . . $ CppUtilities/DateTimeParts#Month. | Daycxx . . $ CppUtilities/DateTimeParts#Day., /**< year, month and day are present */ |
| 155 | Timecxx . . $ CppUtilities/DateTimeParts#Time. = Hourcxx . . $ CppUtilities/DateTimeParts#Hour. | Minutecxx . . $ CppUtilities/DateTimeParts#Minute. | Secondcxx . . $ CppUtilities/DateTimeParts#Second. | SubSecondcxx . . $ CppUtilities/DateTimeParts#SubSecond., /**< hour, minute and (sub)second are present */ |
| 156 | DateTimecxx . . $ CppUtilities/DateTimeParts#DateTime. = Datecxx . . $ CppUtilities/DateTimeParts#Date. | Timecxx . . $ CppUtilities/DateTimeParts#Time., /**< all parts a DateTime object can represent are present */ |
| 157 | TimeZoneDeltacxx . . $ CppUtilities/DateTimeParts#TimeZoneDelta. = DeltaHourcxx . . $ CppUtilities/DateTimeParts#DeltaHour. | DeltaMinutecxx . . $ CppUtilities/DateTimeParts#DeltaMinute., /**< the timezone-delta hour and minute are present */ |
| 158 | Allcxx . . $ CppUtilities/DateTimeParts#All. = DateTimecxx . . $ CppUtilities/DateTimeParts#DateTime. | TimeZoneDeltacxx . . $ CppUtilities/DateTimeParts#TimeZoneDelta., /**< all parts a DateTime object can represent plus the full timezone-delta are present */ |
| 159 | }; |
| 160 | |
| 161 | struct CPP_UTILITIES_EXPORTcxx . . $ `global.h:11:9`! DateTimeExpressioncxx . . $ CppUtilities/DateTimeExpression# { |
| 162 | DateTimecxx . . $ CppUtilities/DateTime# valuecxx . . $ CppUtilities/DateTimeExpression#value.; /**< The value of the time expression as DateTime object. */ |
| 163 | TimeSpancxx . . $ CppUtilities/TimeSpan# deltacxx . . $ CppUtilities/DateTimeExpression#delta.; /**< The delta of \a value from UTC as TimeSpan object. */ |
| 164 | DateTimePartscxx . . $ CppUtilities/DateTimeParts# partscxx . . $ CppUtilities/DateTimeExpression#parts. = DateTimePartscxx . . $ CppUtilities/DateTimeParts#::Nonecxx . . $ CppUtilities/DateTimeParts#None.; /**< The parts present in the expression as flag enum. */ |
| 165 | |
| 166 | constexpr DateTimecxx . . $ CppUtilities/DateTime# gmtcxx . . $ CppUtilities/DateTimeExpression#gmt(13210d37823b2283).() const; |
| 167 | constexpr bool operatorcxx . . $ CppUtilities/DateTimeExpression#`operator==`(53c1e7a9a17790c3).==(const DateTimeExpressioncxx . . $ CppUtilities/DateTimeExpression# &other) const; |
| 168 | stdcxx . . $ std/::stringcxx . . $ std/string# toIsoStringcxx . . $ CppUtilities/DateTimeExpression#toIsoString(e97fc8b60e6313bd).(char dateDelimiter = '-', char timeDelimiter = ':', char timeZoneDelimiter = ':') const; |
| 169 | static DateTimeExpressioncxx . . $ CppUtilities/DateTimeExpression# fromIsoStringcxx . . $ CppUtilities/DateTimeExpression#fromIsoString(61528dc78229123e).(const char *str); |
| 170 | static DateTimeExpressioncxx . . $ CppUtilities/DateTimeExpression# fromStringcxx . . $ CppUtilities/DateTimeExpression#fromString(61528dc78229123e).(const char *str); |
| 171 | }; |
| 172 | |
| 173 | /*! |
| 174 | * \brief Returns the value in UTC time. |
| 175 | */ |
| 176 | constexpr DateTimecxx . . $ CppUtilities/DateTime# DateTimeExpressioncxx . . $ CppUtilities/DateTimeExpression#::gmtcxx . . $ CppUtilities/DateTimeExpression#gmt(13210d37823b2283).() const |
| 177 | { |
| 178 | return valuecxx . . $ CppUtilities/DateTimeExpression#value. -cxx . . $ CppUtilities/DateTime#operator-(c80c8e835accff8). deltacxx . . $ CppUtilities/DateTimeExpression#delta.; |
| 179 | } |
| 180 | |
| 181 | /*! |
| 182 | * \brief Returns whether the expressions are equivalent. |
| 183 | */ |
| 184 | constexpr bool DateTimeExpressioncxx . . $ CppUtilities/DateTimeExpression#::operatorcxx . . $ CppUtilities/DateTimeExpression#`operator==`(53c1e7a9a17790c3).==(const DateTimeExpressioncxx . . $ CppUtilities/DateTimeExpression# &other) const |
| 185 | { |
| 186 | return valuecxx . . $ CppUtilities/DateTimeExpression#value. ==cxx . . $ CppUtilities/DateTime#`operator==`(1665eba9cd91ac19). other.valuecxx . . $ CppUtilities/DateTimeExpression#value. && deltacxx . . $ CppUtilities/DateTimeExpression#delta. ==cxx . . $ CppUtilities/TimeSpan#`operator==`(c3dceef1c3b34f85). other.deltacxx . . $ CppUtilities/DateTimeExpression#delta. && partscxx . . $ CppUtilities/DateTimeExpression#parts. == other.partscxx . . $ CppUtilities/DateTimeExpression#parts.; |
| 187 | } |
| 188 | |
| 189 | /*! |
| 190 | * \brief Constructs a DateTime. |
| 191 | */ |
| 192 | constexpr inline DateTimecxx . . $ CppUtilities/DateTime#::DateTimecxx . . $ CppUtilities/DateTime#DateTime(49f6e7a06ebc5aa8).() |
| 193 | : m_tickscxx . . $ CppUtilities/DateTime#m_ticks.(0) |
| 194 | { |
| 195 | } |
| 196 | |
| 197 | /*! |
| 198 | * \brief Constructs a DateTime with the specified number of \a ticks. |
| 199 | */ |
| 200 | constexpr inline DateTimecxx . . $ CppUtilities/DateTime#::DateTimecxx . . $ CppUtilities/DateTime#DateTime(2c44cd906ae4e829).(TickTypecxx . . $ CppUtilities/DateTime#TickType# ticks) |
| 201 | : m_tickscxx . . $ CppUtilities/DateTime#m_ticks.(ticks) |
| 202 | { |
| 203 | } |
| 204 | |
| 205 | /*! |
| 206 | * \brief Constructs a DateTime to the specified \a year, \a month, and \a day. |
| 207 | * \throws Throws a ConversionException if the specified \a year, \a month or \a day is out-of-range. |
| 208 | */ |
| 209 | inline DateTimecxx . . $ CppUtilities/DateTime# DateTimecxx . . $ CppUtilities/DateTime#::fromDatecxx . . $ CppUtilities/DateTime#fromDate(1d87702ad89c5e62).(int year, int month, int day) |
| 210 | { |
| 211 | return DateTimecxx . . $ CppUtilities/DateTime#DateTime(2c44cd906ae4e829).(dateToTickscxx . . $ CppUtilities/DateTime#dateToTicks(840af37b591364d5).(year, month, day)); |
| 212 | } |
| 213 | |
| 214 | /*! |
| 215 | * \brief Constructs a DateTime to the specified \a hour, \a minute, \a second and \a millisecond. |
| 216 | * \throws Throws a ConversionException if the specified \a hour, \a minute, \a second or \a millisecond is out-of-range. |
| 217 | */ |
| 218 | inline DateTimecxx . . $ CppUtilities/DateTime# DateTimecxx . . $ CppUtilities/DateTime#::fromTimecxx . . $ CppUtilities/DateTime#fromTime(3ef1c1b624b456c3).(int hour, int minute, int second, double millisecond) |
| 219 | { |
| 220 | return DateTimecxx . . $ CppUtilities/DateTime#DateTime(2c44cd906ae4e829).(timeToTickscxx . . $ CppUtilities/DateTime#timeToTicks(c67881ab8ac3a9c7).(hour, minute, second, millisecond)); |
| 221 | } |
| 222 | |
| 223 | /*! |
| 224 | * \brief Constructs a DateTime to the specified \a year, \a month, \a day, \a hour, \a minute, \a second and \a millisecond. |
| 225 | * \throws Throws a ConversionException if the specified \a year, \a month, \a day, \a hour, \a minute, \a second or \a millisecond |
| 226 | * is out-of-range. |
| 227 | */ |
| 228 | inline DateTimecxx . . $ CppUtilities/DateTime# DateTimecxx . . $ CppUtilities/DateTime#::fromDateAndTimecxx . . $ CppUtilities/DateTime#fromDateAndTime(aa79afcea2b9ba5).(int year, int month, int day, int hour, int minute, int second, double millisecond) |
| 229 | { |
| 230 | return DateTimecxx . . $ CppUtilities/DateTime#DateTime(2c44cd906ae4e829).(dateToTickscxx . . $ CppUtilities/DateTime#dateToTicks(840af37b591364d5).(year, month, day) + timeToTickscxx . . $ CppUtilities/DateTime#timeToTicks(c67881ab8ac3a9c7).(hour, minute, second, millisecond)); |
| 231 | } |
| 232 | |
| 233 | /*! |
| 234 | * \brief Parses the given std::string as DateTime. |
| 235 | * \throws Throws a ConversionException if the specified \a str does not match the expected time format. |
| 236 | * |
| 237 | * The expected format is something like "2012-02-29 15:34:20.033" or "2012/02/29 15:34:20.033". The |
| 238 | * delimiters '-', ':' and '/' are exchangeable. |
| 239 | * |
| 240 | * \sa DateTime::fromIsoString() |
| 241 | */ |
| 242 | inline DateTimecxx . . $ CppUtilities/DateTime# DateTimecxx . . $ CppUtilities/DateTime#::fromStringcxx . . $ CppUtilities/DateTime#fromString(8f6aaa1480fe291e).(const stdcxx . . $ std/::stringcxx . . $ std/string# &str) |
| 243 | { |
| 244 | return fromStringcxx . . $ CppUtilities/DateTime#fromString(935e9a342e01659a).(str.datacxx . . $ std/__cxx11/basic_string#data(8e614c7de0b1573e).()); |
| 245 | } |
| 246 | |
| 247 | /*! |
| 248 | * \brief Parses the specified ISO date time denotation provided as C-style string. |
| 249 | * \returns Returns the parsed UTC time. That means a possibly denoted time zone delta is subtracted from the time stamp. |
| 250 | * \throws Throws a ConversionException if the specified \a str does not match the expected time format. |
| 251 | * \sa fromIsoString() |
| 252 | */ |
| 253 | inline DateTimecxx . . $ CppUtilities/DateTime# DateTimecxx . . $ CppUtilities/DateTime#::fromIsoStringGmtcxx . . $ CppUtilities/DateTime#fromIsoStringGmt(935e9a342e01659a).(const char *str) |
| 254 | { |
| 255 | return DateTimeExpressioncxx . . $ CppUtilities/DateTimeExpression#::fromIsoStringcxx . . $ CppUtilities/DateTimeExpression#fromIsoString(61528dc78229123e).(str).gmtcxx . . $ CppUtilities/DateTimeExpression#gmt(13210d37823b2283).(); |
| 256 | } |
| 257 | |
| 258 | /*! |
| 259 | * \brief Parses the specified ISO date time denotation provided as C-style string. |
| 260 | * \returns Returns the parsed local time. That means a possibly denoted time zone delta is discarded. |
| 261 | * \throws Throws a ConversionException if the specified \a str does not match the expected time format. |
| 262 | * \sa fromIsoString() |
| 263 | */ |
| 264 | inline DateTimecxx . . $ CppUtilities/DateTime# DateTimecxx . . $ CppUtilities/DateTime#::fromIsoStringLocalcxx . . $ CppUtilities/DateTime#fromIsoStringLocal(935e9a342e01659a).(const char *str) |
| 265 | { |
| 266 | return DateTimeExpressioncxx . . $ CppUtilities/DateTimeExpression#::fromIsoStringcxx . . $ CppUtilities/DateTimeExpression#fromIsoString(61528dc78229123e).(str).valuecxx . . $ CppUtilities/DateTimeExpression#value.; |
| 267 | } |
| 268 | |
| 269 | /*! |
| 270 | * \brief Constructs a new DateTime object with the GMT time from the specified UNIX \a timeStamp. |
| 271 | */ |
| 272 | constexpr inline DateTimecxx . . $ CppUtilities/DateTime# DateTimecxx . . $ CppUtilities/DateTime#::fromTimeStampGmtcxx . . $ CppUtilities/DateTime#fromTimeStampGmt(481e32044e5fdc05).(stdcxx . . $ std/::time_tcxx . . $ std/time_t# timeStamp) |
| 273 | { |
| 274 | return DateTimecxx . . $ CppUtilities/DateTime#DateTime(2c44cd906ae4e829).(DateTimecxx . . $ CppUtilities/DateTime#::unixEpochStartcxx . . $ CppUtilities/DateTime#unixEpochStart(3a8d563d7eabf3e1).().totalTickscxx . . $ CppUtilities/DateTime#totalTicks(fe4d2d262d4164a8).() + static_cast<stdcxx . . $ std/::uint64_tcxx . . $ std/uint64_t#>(timeStamp) * TimeSpancxx . . $ CppUtilities/TimeSpan#::ticksPerSecondcxx . . $ CppUtilities/TimeSpan#ticksPerSecond.); |
| 275 | } |
| 276 | |
| 277 | /*! |
| 278 | * \brief Constructs a new DateTime object with the local time from the specified std::chrono::time_point. |
| 279 | * \remarks Works only with time points of std::chrono::system_clock so far. C++20 will fix this. Until then this function |
| 280 | * should be considered experimental. |
| 281 | */ |
| 282 | template <typename TimePoint> inline DateTimecxx . . $ CppUtilities/DateTime# DateTimecxx . . $ CppUtilities/DateTime#::fromChronoTimePointcxx . . $ CppUtilities/DateTime#fromChronoTimePoint(2f2ebadf2a7535f3).(TimePoint timePoint) |
| 283 | { |
| 284 | return DateTimecxx . . $ CppUtilities/DateTime#::fromTimeStampcxx . . $ CppUtilities/DateTime#fromTimeStamp(481e32044e5fdc05).(decltype(timePoint)::clock::to_time_t(timePoint)); |
| 285 | } |
| 286 | |
| 287 | /*! |
| 288 | * \brief Constructs a new DateTime object with the GMT time from the specified std::chrono::time_point. |
| 289 | * \remarks Works only with time points of std::chrono::system_clock so far. C++20 will fix this. Until then this function |
| 290 | * should be considered experimental. |
| 291 | */ |
| 292 | template <typename TimePoint> constexpr DateTimecxx . . $ CppUtilities/DateTime# DateTimecxx . . $ CppUtilities/DateTime#::fromChronoTimePointGmtcxx . . $ CppUtilities/DateTime#fromChronoTimePointGmt(2f2ebadf2a7535f3).(TimePoint timePoint) |
| 293 | { |
| 294 | return DateTimecxx . . $ CppUtilities/DateTime#::fromTimeStampGmtcxx . . $ CppUtilities/DateTime#fromTimeStampGmt(481e32044e5fdc05).(decltype(timePoint)::clock::to_time_t(timePoint)); |
| 295 | } |
| 296 | |
| 297 | /*! |
| 298 | * \brief Returns a mutable reference to the total ticks. |
| 299 | */ |
| 300 | constexpr inline DateTimecxx . . $ CppUtilities/DateTime#::TickTypecxx . . $ CppUtilities/DateTime#TickType# &DateTimecxx . . $ CppUtilities/DateTime#::tickscxx . . $ CppUtilities/DateTime#ticks(57d5fc8cf5ed7aa5).() |
| 301 | { |
| 302 | return m_tickscxx . . $ CppUtilities/DateTime#m_ticks.; |
| 303 | } |
| 304 | |
| 305 | /*! |
| 306 | * \brief Returns the number of ticks which represent the value of the current instance. |
| 307 | */ |
| 308 | constexpr inline DateTimecxx . . $ CppUtilities/DateTime#::TickTypecxx . . $ CppUtilities/DateTime#TickType# DateTimecxx . . $ CppUtilities/DateTime#::totalTickscxx . . $ CppUtilities/DateTime#totalTicks(fe4d2d262d4164a8).() const |
| 309 | { |
| 310 | return m_tickscxx . . $ CppUtilities/DateTime#m_ticks.; |
| 311 | } |
| 312 | |
| 313 | /*! |
| 314 | * \brief Returns the year component of the date represented by this instance. |
| 315 | */ |
| 316 | inline int DateTimecxx . . $ CppUtilities/DateTime#::yearcxx . . $ CppUtilities/DateTime#year(455f465bc33b4cdf).() const |
| 317 | { |
| 318 | return getDatePartcxx . . $ CppUtilities/DateTime#getDatePart(702a50be8cbce955).(DatePartcxx . . $ CppUtilities/DatePart#::Yearcxx . . $ CppUtilities/DatePart#Year.); |
| 319 | } |
| 320 | |
| 321 | /*! |
| 322 | * \brief Returns the month component of the date represented by this instance. |
| 323 | */ |
| 324 | inline int DateTimecxx . . $ CppUtilities/DateTime#::monthcxx . . $ CppUtilities/DateTime#month(455f465bc33b4cdf).() const |
| 325 | { |
| 326 | return getDatePartcxx . . $ CppUtilities/DateTime#getDatePart(702a50be8cbce955).(DatePartcxx . . $ CppUtilities/DatePart#::Monthcxx . . $ CppUtilities/DatePart#Month.); |
| 327 | } |
| 328 | |
| 329 | /*! |
| 330 | * \brief Returns the day component of the date represented by this instance. |
| 331 | */ |
| 332 | inline int DateTimecxx . . $ CppUtilities/DateTime#::daycxx . . $ CppUtilities/DateTime#day(455f465bc33b4cdf).() const |
| 333 | { |
| 334 | return getDatePartcxx . . $ CppUtilities/DateTime#getDatePart(702a50be8cbce955).(DatePartcxx . . $ CppUtilities/DatePart#::Daycxx . . $ CppUtilities/DatePart#Day.); |
| 335 | } |
| 336 | |
| 337 | /*! |
| 338 | * \brief Returns the day of the year represented by this instance. |
| 339 | */ |
| 340 | inline int DateTimecxx . . $ CppUtilities/DateTime#::dayOfYearcxx . . $ CppUtilities/DateTime#dayOfYear(455f465bc33b4cdf).() const |
| 341 | { |
| 342 | return getDatePartcxx . . $ CppUtilities/DateTime#getDatePart(702a50be8cbce955).(DatePartcxx . . $ CppUtilities/DatePart#::DayOfYearcxx . . $ CppUtilities/DatePart#DayOfYear.); |
| 343 | } |
| 344 | |
| 345 | /*! |
| 346 | * \brief Returns the day of the week represented by this instance. |
| 347 | * \sa DayOfWeek |
| 348 | */ |
| 349 | constexpr inline DayOfWeekcxx . . $ CppUtilities/DayOfWeek# DateTimecxx . . $ CppUtilities/DateTime#::dayOfWeekcxx . . $ CppUtilities/DateTime#dayOfWeek(d50da9aa82afe8a1).() const |
| 350 | { |
| 351 | return static_cast<DayOfWeekcxx . . $ CppUtilities/DayOfWeek#>((m_tickscxx . . $ CppUtilities/DateTime#m_ticks. / TimeSpancxx . . $ CppUtilities/TimeSpan#::ticksPerDaycxx . . $ CppUtilities/TimeSpan#ticksPerDay.) % 7l); |
| 352 | } |
| 353 | |
| 354 | /*! |
| 355 | * \brief Returns the hour component of the date represented by this instance. |
| 356 | */ |
| 357 | constexpr inline int DateTimecxx . . $ CppUtilities/DateTime#::hourcxx . . $ CppUtilities/DateTime#hour(455f465bc33b4cdf).() const |
| 358 | { |
| 359 | return static_cast<int>(m_tickscxx . . $ CppUtilities/DateTime#m_ticks. / TimeSpancxx . . $ CppUtilities/TimeSpan#::ticksPerHourcxx . . $ CppUtilities/TimeSpan#ticksPerHour. % 24ul); |
| 360 | } |
| 361 | |
| 362 | /*! |
| 363 | *\brief Returns the minute component of the date represented by this instance. |
| 364 | */ |
| 365 | constexpr inline int DateTimecxx . . $ CppUtilities/DateTime#::minutecxx . . $ CppUtilities/DateTime#minute(455f465bc33b4cdf).() const |
| 366 | { |
| 367 | return static_cast<int>(m_tickscxx . . $ CppUtilities/DateTime#m_ticks. / TimeSpancxx . . $ CppUtilities/TimeSpan#::ticksPerMinutecxx . . $ CppUtilities/TimeSpan#ticksPerMinute. % 60ul); |
| 368 | } |
| 369 | |
| 370 | /*! |
| 371 | * \brief Returns the second component of the date represented by this instance. |
| 372 | */ |
| 373 | constexpr inline int DateTimecxx . . $ CppUtilities/DateTime#::secondcxx . . $ CppUtilities/DateTime#second(455f465bc33b4cdf).() const |
| 374 | { |
| 375 | return static_cast<int>(m_tickscxx . . $ CppUtilities/DateTime#m_ticks. / TimeSpancxx . . $ CppUtilities/TimeSpan#::ticksPerSecondcxx . . $ CppUtilities/TimeSpan#ticksPerSecond. % 60ul); |
| 376 | } |
| 377 | |
| 378 | /*! |
| 379 | * \brief Returns the millisecond component of the date represented by this instance. |
| 380 | */ |
| 381 | constexpr inline int DateTimecxx . . $ CppUtilities/DateTime#::millisecondcxx . . $ CppUtilities/DateTime#millisecond(455f465bc33b4cdf).() const |
| 382 | { |
| 383 | return static_cast<int>(m_tickscxx . . $ CppUtilities/DateTime#m_ticks. / TimeSpancxx . . $ CppUtilities/TimeSpan#::ticksPerMillisecondcxx . . $ CppUtilities/TimeSpan#ticksPerMillisecond. % 1000ul); |
| 384 | } |
| 385 | |
| 386 | /*! |
| 387 | * \brief Returns the microsecond component of the date represented by this instance. |
| 388 | */ |
| 389 | constexpr inline int DateTimecxx . . $ CppUtilities/DateTime#::microsecondcxx . . $ CppUtilities/DateTime#microsecond(455f465bc33b4cdf).() const |
| 390 | { |
| 391 | return static_cast<int>(m_tickscxx . . $ CppUtilities/DateTime#m_ticks. / TimeSpancxx . . $ CppUtilities/TimeSpan#::ticksPerMicrosecondcxx . . $ CppUtilities/TimeSpan#ticksPerMicrosecond. % 1000ul); |
| 392 | } |
| 393 | |
| 394 | /*! |
| 395 | * \brief Returns the nanosecond component of the date represented by this instance. |
| 396 | * \remarks The accuracy of the DateTime class is 100-nanoseconds. Hence the returned value |
| 397 | * will always have two zeros at the end (in decimal representation). |
| 398 | */ |
| 399 | constexpr inline int DateTimecxx . . $ CppUtilities/DateTime#::nanosecondcxx . . $ CppUtilities/DateTime#nanosecond(455f465bc33b4cdf).() const |
| 400 | { |
| 401 | return static_cast<int>(m_tickscxx . . $ CppUtilities/DateTime#m_ticks. % 10ul * TimeSpancxx . . $ CppUtilities/TimeSpan#::nanosecondsPerTickcxx . . $ CppUtilities/TimeSpan#nanosecondsPerTick.); |
| 402 | } |
| 403 | |
| 404 | /*! |
| 405 | * \brief Returns true if the date represented by the current DateTime class is null. |
| 406 | * \sa DateTime |
| 407 | */ |
| 408 | constexpr inline bool DateTimecxx . . $ CppUtilities/DateTime#::isNullcxx . . $ CppUtilities/DateTime#isNull(50ce9a9e25b4a850).() const |
| 409 | { |
| 410 | return m_tickscxx . . $ CppUtilities/DateTime#m_ticks. == 0; |
| 411 | } |
| 412 | |
| 413 | /*! |
| 414 | * \brief Returns the time of day as TimeSpan for this instance. |
| 415 | */ |
| 416 | constexpr inline TimeSpancxx . . $ CppUtilities/TimeSpan# DateTimecxx . . $ CppUtilities/DateTime#::timeOfDaycxx . . $ CppUtilities/DateTime#timeOfDay(af1383a2c4e36306).() const |
| 417 | { |
| 418 | return TimeSpancxx . . $ CppUtilities/TimeSpan#(static_cast<TimeSpancxx . . $ CppUtilities/TimeSpan#::TickTypecxx . . $ CppUtilities/TimeSpan#TickType#>(m_tickscxx . . $ CppUtilities/DateTime#m_ticks. % TimeSpancxx . . $ CppUtilities/TimeSpan#::ticksPerDaycxx . . $ CppUtilities/TimeSpan#ticksPerDay.)); |
| 419 | } |
| 420 | |
| 421 | /*! |
| 422 | * \brief Returns an indication whether the year represented by this instance is a leap year. |
| 423 | */ |
| 424 | inline bool DateTimecxx . . $ CppUtilities/DateTime#::isLeapYearcxx . . $ CppUtilities/DateTime#isLeapYear(50ce9a9e25b4a850).() const |
| 425 | { |
| 426 | return isLeapYearcxx . . $ CppUtilities/DateTime#isLeapYear(83c267b20bac841a).(yearcxx . . $ CppUtilities/DateTime#year(455f465bc33b4cdf).()); |
| 427 | } |
| 428 | |
| 429 | /*! |
| 430 | * \brief Returns whether the instance has the maximal number of ticks. |
| 431 | */ |
| 432 | constexpr inline bool DateTimecxx . . $ CppUtilities/DateTime#::isEternitycxx . . $ CppUtilities/DateTime#isEternity(50ce9a9e25b4a850).() const |
| 433 | { |
| 434 | return m_tickscxx . . $ CppUtilities/DateTime#m_ticks. == stdcxx . . $ std/::numeric_limitscxx . . $ std/numeric_limits#<TickType>::maxcxx . . $ std/numeric_limits#max(cee159cc271e827).(); |
| 435 | } |
| 436 | |
| 437 | /*! |
| 438 | * \brief Returns an indication whether the specified \a year is a leap year. |
| 439 | */ |
| 440 | constexpr inline bool DateTimecxx . . $ CppUtilities/DateTime#::isLeapYearcxx . . $ CppUtilities/DateTime#isLeapYear(83c267b20bac841a).(int year) |
| 441 | { |
| 442 | return (year % 4 != 0) ? false : ((year % 100 == 0) ? (year % 400 == 0) : true); |
| 443 | } |
| 444 | |
| 445 | /*! |
| 446 | * \brief Returns the number of days in the specified \a month and \a year. |
| 447 | */ |
| 448 | inline int DateTimecxx . . $ CppUtilities/DateTime#::daysInMonthcxx . . $ CppUtilities/DateTime#daysInMonth(9b79fb6aee4c0440).(int year, int month) |
| 449 | { |
| 450 | return (month >= 1 && month <= 12) ? (isLeapYearcxx . . $ CppUtilities/DateTime#isLeapYear(83c267b20bac841a).(year) ? m_daysInMonth366cxx . . $ CppUtilities/DateTime#m_daysInMonth366.[month - 1] : m_daysInMonth365cxx . . $ CppUtilities/DateTime#m_daysInMonth365.[month - 1]) : (0); |
| 451 | } |
| 452 | |
| 453 | /*! |
| 454 | * \brief Returns and indication whether two DateTime instances represent the same day. |
| 455 | */ |
| 456 | constexpr inline bool DateTimecxx . . $ CppUtilities/DateTime#::isSameDaycxx . . $ CppUtilities/DateTime#isSameDay(1665eba9cd91ac19).(const DateTimecxx . . $ CppUtilities/DateTime# &other) const |
| 457 | { |
| 458 | return (m_tickscxx . . $ CppUtilities/DateTime#m_ticks. / TimeSpancxx . . $ CppUtilities/TimeSpan#::ticksPerDaycxx . . $ CppUtilities/TimeSpan#ticksPerDay.) == (other.m_tickscxx . . $ CppUtilities/DateTime#m_ticks. / TimeSpancxx . . $ CppUtilities/TimeSpan#::ticksPerDaycxx . . $ CppUtilities/TimeSpan#ticksPerDay.); |
| 459 | } |
| 460 | |
| 461 | /*! |
| 462 | * \brief Returns the string representation of the current instance using the specified \a format. |
| 463 | * \remarks If \a noMilliseconds is true the date will be rounded to full seconds. |
| 464 | * \sa toIsoString() for ISO format |
| 465 | */ |
| 466 | inline stdcxx . . $ std/::stringcxx . . $ std/string# DateTimecxx . . $ CppUtilities/DateTime#::toStringcxx . . $ CppUtilities/DateTime#toString(ae2e5394ab87f360).(DateTimeOutputFormatcxx . . $ CppUtilities/DateTimeOutputFormat# format, bool noMilliseconds) const |
| 467 | { |
| 468 | stdcxx . . $ std/::stringcxx . . $ std/string# resultcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).; |
| 469 | toStringcxx . . $ CppUtilities/DateTime#toString(dc9785426bdd7430).(result, format, noMilliseconds); |
| 470 | return resultcxx . . $ std/__cxx11/basic_string#basic_string(8f3aaafa33d05d0b).; |
| 471 | } |
| 472 | |
| 473 | /*! |
| 474 | * \brief Returns the UNIX timestamp for the current instance. |
| 475 | */ |
| 476 | constexpr stdcxx . . $ std/::time_tcxx . . $ std/time_t# DateTimecxx . . $ CppUtilities/DateTime#::toTimeStampcxx . . $ CppUtilities/DateTime#toTimeStamp(57a65ae535d7db84).() const |
| 477 | { |
| 478 | return static_cast<stdcxx . . $ std/::time_tcxx . . $ std/time_t#>((totalTickscxx . . $ CppUtilities/DateTime#totalTicks(fe4d2d262d4164a8).() - DateTimecxx . . $ CppUtilities/DateTime#::unixEpochStartcxx . . $ CppUtilities/DateTime#unixEpochStart(3a8d563d7eabf3e1).().totalTickscxx . . $ CppUtilities/DateTime#totalTicks(fe4d2d262d4164a8).()) / TimeSpancxx . . $ CppUtilities/TimeSpan#::ticksPerSecondcxx . . $ CppUtilities/TimeSpan#ticksPerSecond.); |
| 479 | } |
| 480 | |
| 481 | /*! |
| 482 | * \brief Constructs a new instance of the DateTime class with the maximal number of ticks. |
| 483 | */ |
| 484 | constexpr inline DateTimecxx . . $ CppUtilities/DateTime# DateTimecxx . . $ CppUtilities/DateTime#::eternitycxx . . $ CppUtilities/DateTime#eternity(3a8d563d7eabf3e1).() |
| 485 | { |
| 486 | return DateTimecxx . . $ CppUtilities/DateTime#DateTime(2c44cd906ae4e829).(stdcxx . . $ std/::numeric_limitscxx . . $ std/numeric_limits#<TickType>::maxcxx . . $ std/numeric_limits#max(cee159cc271e827).()); |
| 487 | } |
| 488 | |
| 489 | /*! |
| 490 | * \brief Returns the DateTime object for the "1970-01-01T00:00:00Z". |
| 491 | */ |
| 492 | constexpr inline DateTimecxx . . $ CppUtilities/DateTime# DateTimecxx . . $ CppUtilities/DateTime#::unixEpochStartcxx . . $ CppUtilities/DateTime#unixEpochStart(3a8d563d7eabf3e1).() |
| 493 | { |
| 494 | return DateTimecxx . . $ CppUtilities/DateTime#DateTime(2c44cd906ae4e829).(621355968000000000); |
| 495 | } |
| 496 | |
| 497 | /*! |
| 498 | * \brief Returns a DateTime object that is set to the current date and time on this computer, expressed as the local time. |
| 499 | * \remarks The time might be rounded to full seconds. Use exactGmtNow() for better precision. |
| 500 | */ |
| 501 | inline DateTimecxx . . $ CppUtilities/DateTime# DateTimecxx . . $ CppUtilities/DateTime#::nowcxx . . $ CppUtilities/DateTime#now(3a8d563d7eabf3e1).() |
| 502 | { |
| 503 | return DateTimecxx . . $ CppUtilities/DateTime#::fromTimeStampcxx . . $ CppUtilities/DateTime#fromTimeStamp(481e32044e5fdc05).(stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(nullptr)); |
| 504 | } |
| 505 | |
| 506 | /*! |
| 507 | * \brief Returns a DateTime object that is set to the current date and time on this computer, expressed as the GMT time. |
| 508 | * \remarks The time might be rounded to full seconds. Use exactGmtNow() for better precision. |
| 509 | */ |
| 510 | inline DateTimecxx . . $ CppUtilities/DateTime# DateTimecxx . . $ CppUtilities/DateTime#::gmtNowcxx . . $ CppUtilities/DateTime#gmtNow(3a8d563d7eabf3e1).() |
| 511 | { |
| 512 | return DateTimecxx . . $ CppUtilities/DateTime#::fromTimeStampGmtcxx . . $ CppUtilities/DateTime#fromTimeStampGmt(481e32044e5fdc05).(stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(nullptr)); |
| 513 | } |
| 514 | |
| 515 | /*! |
| 516 | * \brief Indicates whether two DateTime instances are equal. |
| 517 | */ |
| 518 | constexpr inline bool DateTimecxx . . $ CppUtilities/DateTime#::operatorcxx . . $ CppUtilities/DateTime#`operator==`(1665eba9cd91ac19).==(const DateTimecxx . . $ CppUtilities/DateTime# &other) const |
| 519 | { |
| 520 | return m_tickscxx . . $ CppUtilities/DateTime#m_ticks. == other.m_tickscxx . . $ CppUtilities/DateTime#m_ticks.; |
| 521 | } |
| 522 | |
| 523 | /*! |
| 524 | * \brief Indicates whether two DateTime instances are not equal. |
| 525 | */ |
| 526 | constexpr inline bool DateTimecxx . . $ CppUtilities/DateTime#::operatorcxx . . $ CppUtilities/DateTime#`operator!=`(1665eba9cd91ac19).!=(const DateTimecxx . . $ CppUtilities/DateTime# &other) const |
| 527 | { |
| 528 | return m_tickscxx . . $ CppUtilities/DateTime#m_ticks. != other.m_tickscxx . . $ CppUtilities/DateTime#m_ticks.; |
| 529 | } |
| 530 | |
| 531 | /*! |
| 532 | * \brief Indicates whether a specified DateTime is less than another specified DateTime. |
| 533 | */ |
| 534 | constexpr inline bool DateTimecxx . . $ CppUtilities/DateTime#::operatorcxx . . $ CppUtilities/DateTime#`operator<`(1665eba9cd91ac19).<(const DateTimecxx . . $ CppUtilities/DateTime# &other) const |
| 535 | { |
| 536 | return m_tickscxx . . $ CppUtilities/DateTime#m_ticks. < other.m_tickscxx . . $ CppUtilities/DateTime#m_ticks.; |
| 537 | } |
| 538 | |
| 539 | /*! |
| 540 | * \brief Indicates whether a specified DateTime is greater than another specified DateTime. |
| 541 | */ |
| 542 | constexpr inline bool DateTimecxx . . $ CppUtilities/DateTime#::operatorcxx . . $ CppUtilities/DateTime#`operator>`(1665eba9cd91ac19).>(const DateTimecxx . . $ CppUtilities/DateTime# &other) const |
| 543 | { |
| 544 | return m_tickscxx . . $ CppUtilities/DateTime#m_ticks. > other.m_tickscxx . . $ CppUtilities/DateTime#m_ticks.; |
| 545 | } |
| 546 | |
| 547 | /*! |
| 548 | * \brief Indicates whether a specified DateTime is less or equal than another specified DateTime. |
| 549 | */ |
| 550 | constexpr inline bool DateTimecxx . . $ CppUtilities/DateTime#::operatorcxx . . $ CppUtilities/DateTime#`operator<=`(1665eba9cd91ac19).<=(const DateTimecxx . . $ CppUtilities/DateTime# &other) const |
| 551 | { |
| 552 | return m_tickscxx . . $ CppUtilities/DateTime#m_ticks. <= other.m_tickscxx . . $ CppUtilities/DateTime#m_ticks.; |
| 553 | } |
| 554 | |
| 555 | /*! |
| 556 | * \brief Indicates whether a specified DateTime is greater or equal than another specified DateTime. |
| 557 | */ |
| 558 | constexpr inline bool DateTimecxx . . $ CppUtilities/DateTime#::operatorcxx . . $ CppUtilities/DateTime#`operator>=`(1665eba9cd91ac19).>=(const DateTimecxx . . $ CppUtilities/DateTime# &other) const |
| 559 | { |
| 560 | return m_tickscxx . . $ CppUtilities/DateTime#m_ticks. >= other.m_tickscxx . . $ CppUtilities/DateTime#m_ticks.; |
| 561 | } |
| 562 | |
| 563 | /*! |
| 564 | * \brief Adds another instance. |
| 565 | * \returns The result is another DateTime. |
| 566 | */ |
| 567 | constexpr inline DateTimecxx . . $ CppUtilities/DateTime# DateTimecxx . . $ CppUtilities/DateTime#::operatorcxx . . $ CppUtilities/DateTime#operator+(c80c8e835accff8).+(const TimeSpancxx . . $ CppUtilities/TimeSpan# &timeSpan) const |
| 568 | { |
| 569 | return DateTimecxx . . $ CppUtilities/DateTime#DateTime(2c44cd906ae4e829).(m_tickscxx . . $ CppUtilities/DateTime#m_ticks. + static_cast<TickTypecxx . . $ CppUtilities/DateTime#TickType#>(timeSpan.m_tickscxx . . $ CppUtilities/TimeSpan#m_ticks.)); |
| 570 | } |
| 571 | |
| 572 | /*! |
| 573 | * \brief Subtracts another instance. |
| 574 | * \returns The result is another DateTime. |
| 575 | */ |
| 576 | constexpr inline DateTimecxx . . $ CppUtilities/DateTime# DateTimecxx . . $ CppUtilities/DateTime#::operatorcxx . . $ CppUtilities/DateTime#operator-(c80c8e835accff8).-(const TimeSpancxx . . $ CppUtilities/TimeSpan# &timeSpan) const |
| 577 | { |
| 578 | return DateTimecxx . . $ CppUtilities/DateTime#DateTime(2c44cd906ae4e829).(m_tickscxx . . $ CppUtilities/DateTime#m_ticks. - static_cast<TickTypecxx . . $ CppUtilities/DateTime#TickType#>(timeSpan.m_tickscxx . . $ CppUtilities/TimeSpan#m_ticks.)); |
| 579 | } |
| 580 | |
| 581 | /*! |
| 582 | * \brief Adds two instances. |
| 583 | * \returns The result is a TimeSpan. |
| 584 | */ |
| 585 | constexpr inline TimeSpancxx . . $ CppUtilities/TimeSpan# DateTimecxx . . $ CppUtilities/DateTime#::operatorcxx . . $ CppUtilities/DateTime#operator+(4af8d3bed6a52170).+(const DateTimecxx . . $ CppUtilities/DateTime# &other) const |
| 586 | { |
| 587 | return TimeSpancxx . . $ CppUtilities/TimeSpan#TimeSpan(1624ee8275b10bda).(static_cast<TimeSpancxx . . $ CppUtilities/TimeSpan#::TickTypecxx . . $ CppUtilities/TimeSpan#TickType#>(m_tickscxx . . $ CppUtilities/DateTime#m_ticks. + other.m_tickscxx . . $ CppUtilities/DateTime#m_ticks.)); |
| 588 | } |
| 589 | |
| 590 | /*! |
| 591 | * \brief Subtracts two DateTime instances. |
| 592 | * \returns The result is a TimeSpan. |
| 593 | * \remarks For expressing the delta between two concrete DateTime instances in terms of |
| 594 | * years, month and days, use Period::Period instead. |
| 595 | */ |
| 596 | constexpr inline TimeSpancxx . . $ CppUtilities/TimeSpan# DateTimecxx . . $ CppUtilities/DateTime#::operatorcxx . . $ CppUtilities/DateTime#operator-(4af8d3bed6a52170).-(const DateTimecxx . . $ CppUtilities/DateTime# &other) const |
| 597 | { |
| 598 | return TimeSpancxx . . $ CppUtilities/TimeSpan#TimeSpan(1624ee8275b10bda).(static_cast<TimeSpancxx . . $ CppUtilities/TimeSpan#::TickTypecxx . . $ CppUtilities/TimeSpan#TickType#>(m_tickscxx . . $ CppUtilities/DateTime#m_ticks. - other.m_tickscxx . . $ CppUtilities/DateTime#m_ticks.)); |
| 599 | } |
| 600 | |
| 601 | /*! |
| 602 | * \brief Adds a TimeSpan to the current instance. |
| 603 | */ |
| 604 | inline DateTimecxx . . $ CppUtilities/DateTime# &DateTimecxx . . $ CppUtilities/DateTime#::operatorcxx . . $ CppUtilities/DateTime#`operator+=`(5f92a35c43125233).+=(const TimeSpancxx . . $ CppUtilities/TimeSpan# &timeSpan) |
| 605 | { |
| 606 | m_tickscxx . . $ CppUtilities/DateTime#m_ticks. += static_cast<TickTypecxx . . $ CppUtilities/DateTime#TickType#>(timeSpan.m_tickscxx . . $ CppUtilities/TimeSpan#m_ticks.); |
| 607 | return *this; |
| 608 | } |
| 609 | |
| 610 | /*! |
| 611 | * \brief Subtracts a TimeSpan from the current instance. |
| 612 | */ |
| 613 | inline DateTimecxx . . $ CppUtilities/DateTime# &DateTimecxx . . $ CppUtilities/DateTime#::operatorcxx . . $ CppUtilities/DateTime#`operator-=`(5f92a35c43125233).-=(const TimeSpancxx . . $ CppUtilities/TimeSpan# &timeSpan) |
| 614 | { |
| 615 | m_tickscxx . . $ CppUtilities/DateTime#m_ticks. += static_cast<TickTypecxx . . $ CppUtilities/DateTime#TickType#>(timeSpan.m_tickscxx . . $ CppUtilities/TimeSpan#m_ticks.); |
| 616 | return *this; |
| 617 | } |
| 618 | } // namespace CppUtilities |
| 619 | |
| 620 | namespace stdcxx . . $ std/ { |
| 621 | /// \brief Computes the hash for the CppUtilities::DateTime instance. |
| 622 | template <> struct hashcxx . . $ std/hash#<CppUtilitiescxx . . $ CppUtilities/::DateTimecxx . . $ CppUtilities/DateTime#> { |
| 623 | inline size_tcxx . . $ std/size_t# operatorcxx . . $ std/hash#`operator()`(e82d6fda6bedda94).()(const CppUtilitiescxx . . $ CppUtilities/::DateTimecxx . . $ CppUtilities/DateTime# &dateTime) const |
| 624 | { |
| 625 | return hashcxx . . $ std/hash#<CppUtilitiescxx . . $ CppUtilities/::DateTimecxx . . $ CppUtilities/DateTime#::TickTypecxx . . $ CppUtilities/DateTime#TickType#>()(cxx . . $ std/hash#`operator()`(c3439d1ce488c664).dateTime.totalTickscxx . . $ CppUtilities/DateTime#totalTicks(fe4d2d262d4164a8).()); |
| 626 | } |
| 627 | }; |
| 628 | } // namespace std |
| 629 | |
| 630 | CPP_UTILITIES_MARK_FLAG_ENUM_CLASScxx . . $ CppUtilities/DateTimeParts#(CppUtilities, CppUtilities::DateTimeParts); |
| 631 | |
| 632 | #endif // CHRONO_UTILITIES_DATETIME_H |