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].");
467 throw InvalidException(
"Year out of range for an MS-DOS Date & Time object. Range is [1980, 2107] (1).");
550 unix_timestamp &= ~1;
554 localtime_s(&t, &unix_timestamp);
556 localtime_r(&unix_timestamp, &t);
564 if(t.tm_year < 1980 - 1900
565 || t.tm_year > 2107 - 1900)
567 throw InvalidException(
"Year out of range for an MS-DOS Date & Time object. Range is [1980, 2107] (2).");
619 if(
sizeof(std::time_t) == 4
620 && t.tm_year >= 2038)
629 throw InvalidException(
"Year out of range for a 32 bit Unix Timestamp object. Range is (1901, 2038).");
dosdatetime_t m_dosdatetime
dosdatetime_t getDOSDateTime() const
Retrieve the DOSDateTime value as is.
int getMinute() const
Get the minute.
std::time_t getUnixTimestamp() const
Retrieve the DOSDateTime as a Unix timestamp.
bool isValid() const
Check whether this DOS Date & Date is valid.
int getSecond() const
Get the second.
int daysInMonth() const
Calculate the number of days in this date's month.
void setDOSDateTime(dosdatetime_t datetime)
Set the DOSDateTime value as is.
int getMonth() const
Get the month.
static dosdatetime_t const g_max_dosdatetime
static dosdatetime_t const g_min_dosdatetime
void setSecond(int second)
Set the second.
void setYear(int year)
Set the year.
void setHour(int hour)
Set the hour.
void setMonth(int month)
Set the month.
void setUnixTimestamp(std::time_t unix_timestamp)
Set the DOSDateTime value from a Unix timestamp.
int getMDay() const
Get the day of the month.
int getYear() const
Get the year.
void setMDay(int mday)
Set the day of the month.
void setMinute(int minute)
Set the minute.
int getHour() const
Get the hour.
An InvalidException is used when invalid data is provided.
Define a type to manage date and time in MS-DOS format.
int const g_days_in_month[12]
Number of days in a month.
The zipios namespace includes the Zipios library definitions.
DOSDateTime::dosdatetime_t m_year
DOSDateTime::dosdatetime_t m_second
DOSDateTime::dosdatetime_t m_month
DOSDateTime::dosdatetime_t m_minute
DOSDateTime::dosdatetime_t m_mday
DOSDateTime::dosdatetime_t m_hour
Union used to convert the uint32_t to fields and vice versa.
DOSDateTime::dosdatetime_t m_dosdatetime
struct zipios::dosdatetime_convert_t::fields m_fields
Various exceptions used throughout the Zipios library, all based on zipios::Exception.