60 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 110 31 + 0 + 31 + 30 + 31,
111 31 + 0 + 31 + 30 + 31 + 30,
112 31 + 0 + 31 + 30 + 31 + 30 + 31,
113 31 + 0 + 31 + 30 + 31 + 30 + 31 + 31,
114 31 + 0 + 31 + 30 + 31 + 30 + 31 + 31 + 30,
115 31 + 0 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31,
116 31 + 0 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30
195 return ((year) % 400) == 0
197 : (((year) % 100) == 0
339 throw InvalidException(
"Second is out of range for an MS-DOS Date & Time object. Range is [0, 59].");
364 throw InvalidException(
"Minute is out of range for an MS-DOS Date & Time object. Range is [0, 59].");
389 throw InvalidException(
"Hour is out of range for an MS-DOS Date & Time object. Range is [0, 23].");
419 throw InvalidException(
"Day of the month is out of range for an MS-DOS Date & Time object. Range is [1, 31].");
443 throw InvalidException(
"Month out of range for an MS-DOS Date & Time object. Range is [1, 12].");
469 throw InvalidException(
"Year out of range for an MS-DOS Date & Time object. Range is [1980, 2107] (1).");
552 unix_timestamp &= ~1;
555 #ifdef ZIPIOS_WINDOWS 556 localtime_s(&t, &unix_timestamp);
558 localtime_r(&unix_timestamp, &t);
566 if(t.tm_year < 1980 - 1900
567 || t.tm_year > 2107 - 1900)
569 throw InvalidException(
"Year out of range for an MS-DOS Date & Time object. Range is [1980, 2107] (2).");
621 if(
sizeof(std::time_t) == 4
622 && t.tm_year >= 2038)
631 throw InvalidException(
"Year out of range for a 32 bit Unix Timestamp object. Range is (1901, 2038).");
Define a type to manage date and time in MS-DOS format.
dosdatetime_t m_dosdatetime
DOSDateTime::dosdatetime_t m_dosdatetime
The zipios namespace includes the Zipios library definitions.
int getMinute() const
Get the minute.
int getMonth() const
Get the month.
void setMDay(int mday)
Set the day of the month.
dosdatetime_t getDOSDateTime() const
Retrieve the DOSDateTime value as is.
Various exceptions used throughout the Zipios library, all based on zipios::Exception.
std::time_t getUnixTimestamp() const
Retrieve the DOSDateTime as a Unix timestamp.
void setUnixTimestamp(std::time_t unix_timestamp)
Set the DOSDateTime value from a Unix timestamp.
static dosdatetime_t const g_max_dosdatetime
DOSDateTime::dosdatetime_t m_second
bool isValid() const
Check whether this DOS Date & Date is valid.
int const g_days_in_month[12]
Number of days in a month.
int getMDay() const
Get the day of the month.
int getSecond() const
Get the second.
DOSDateTime::dosdatetime_t m_year
void setMinute(int minute)
Set the minute.
DOSDateTime::dosdatetime_t m_minute
void setSecond(int second)
Set the second.
int daysInMonth() const
Calculate the number of days in this date's month.
DOSDateTime::dosdatetime_t m_month
void setYear(int year)
Set the year.
struct zipios::dosdatetime_convert_t::fields m_fields
An InvalidException is used when invalid data is provided.
DOSDateTime::dosdatetime_t m_mday
void setHour(int hour)
Set the hour.
int getYear() const
Get the year.
DOSDateTime::dosdatetime_t m_hour
void setDOSDateTime(dosdatetime_t datetime)
Set the DOSDateTime value as is.
void setMonth(int month)
Set the month.
int getHour() const
Get the hour.
Union used to convert the uint32_t to fields and vice versa.
static dosdatetime_t const g_min_dosdatetime