105 31 + 0 + 31 + 30 + 31,
106 31 + 0 + 31 + 30 + 31 + 30,
107 31 + 0 + 31 + 30 + 31 + 30 + 31,
108 31 + 0 + 31 + 30 + 31 + 30 + 31 + 31,
109 31 + 0 + 31 + 30 + 31 + 30 + 31 + 31 + 30,
110 31 + 0 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31,
111 31 + 0 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30
190 return ((year) % 400) == 0
192 : (((year) % 100) == 0
334 throw InvalidException(
"Second is out of range for an MS-DOS Date & Time object. Range is [0, 59].");
359 throw InvalidException(
"Minute is out of range for an MS-DOS Date & Time object. Range is [0, 59].");
384 throw InvalidException(
"Hour is out of range for an MS-DOS Date & Time object. Range is [0, 23].");
414 throw InvalidException(
"Day of the month is out of range for an MS-DOS Date & Time object. Range is [1, 31].");
438 throw InvalidException(
"Month out of range for an MS-DOS Date & Time object. Range is [1, 12].");
464 throw InvalidException(
"Year out of range for an MS-DOS Date & Time object. Range is [1980, 2107].");
547 unix_timestamp &= -2;
550 localtime_r(&unix_timestamp, &t);
557 if(t.tm_year < 1980 - 1900
558 || t.tm_year > 2107 - 1900)
560 throw InvalidException(
"Year out of range for an MS-DOS Date & Time object. Range is [1980, 2107].");
612 if(
sizeof(std::time_t) == 4
613 && t.tm_year >= 2038)
622 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
std::time_t getUnixTimestamp() const
Retrieve the DOSDateTime as a Unix timestamp.
DOSDateTime::dosdatetime_t m_dosdatetime
int getHour() const
Get the hour.
void setMDay(int mday)
Set the day of the month.
Various exceptions used throughout the Zipios library, all based on zipios::Exception.
dosdatetime_t getDOSDateTime() const
Retrieve the DOSDateTime value as is.
void setUnixTimestamp(std::time_t unix_timestamp)
Set the DOSDateTime value from a Unix timestamp.
int getMonth() const
Get the month.
static dosdatetime_t const g_max_dosdatetime
DOSDateTime::dosdatetime_t m_second
bool isValid() const
Check whether this DOS Date & Date is valid.
int daysInMonth() const
Calculate the number of days in this date's month.
int const g_days_in_month[12]
Number of days in a month.
DOSDateTime::dosdatetime_t m_year
void setMinute(int minute)
Set the minute.
int getMDay() const
Get the day of the month.
DOSDateTime::dosdatetime_t m_minute
void setSecond(int second)
Set the second.
int getSecond() const
Get the second.
DOSDateTime::dosdatetime_t m_month
int getMinute() const
Get the minute.
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.
Union used to convert the uint32_t to fields and vice versa.
static dosdatetime_t const g_min_dosdatetime