diff options
author | 2017-04-05 21:39:00 -0400 | |
---|---|---|
committer | 2017-04-06 11:39:00 +1000 | |
commit | f809f0e08d451c7fa05116c9c7b147f499ea82d7 (patch) | |
tree | 8a97a329d1be1014fb51bd36b400c4dee4d2153f /src/lib/util/coreutil.cpp | |
parent | ee19701c2cd582c17c8a3b855386cd1b79856560 (diff) |
Introduced an 'util::arbitrary_clock' template class, to represent a clock that "knows" when the epoch starts (#2010)
* Introduced an 'util::arbitrary_clock' template class, to represent a clock that "knows" when the epoch starts
Also:
- Converted the NTFS filetime code to use util::arbitrary_clock
- Converted the Mac datetime code to use util::atribrary_clock
This is in preparation for a bigger change to Imgtool where I eliminate usage of time_t
Diffstat (limited to 'src/lib/util/coreutil.cpp')
-rw-r--r-- | src/lib/util/coreutil.cpp | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/lib/util/coreutil.cpp b/src/lib/util/coreutil.cpp index 8ff9585d476..bd10802ef5a 100644 --- a/src/lib/util/coreutil.cpp +++ b/src/lib/util/coreutil.cpp @@ -59,39 +59,6 @@ uint32_t bcd_2_dec(uint32_t a) /*************************************************************************** - GREGORIAN CALENDAR HELPERS -***************************************************************************/ - -int gregorian_is_leap_year(int year) -{ - return !((year % 100) ? (year % 4) : (year % 400)); -} - - -/* months are one counted */ - -/** - * @fn int gregorian_days_in_month(int month, int year) - * - * @brief Gregorian days in month. - * - * @param month The month. - * @param year The year. - * - * @return An int. - */ - -int gregorian_days_in_month(int month, int year) -{ - assert(month >= 1 && month <= 12); - - int days[] = { 31,28,31,30,31,30,31,31,30,31,30,31 }; - days[1] += gregorian_is_leap_year(year) ? 1 : 0; - return days[month-1]; -} - - -/*************************************************************************** MISC ***************************************************************************/ |