tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ISODate.h (854B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 #ifndef intl_components_calendar_ISODate_h_
      5 #define intl_components_calendar_ISODate_h_
      6 
      7 #include "mozilla/intl/calendar/MonthCode.h"
      8 
      9 #include <stdint.h>
     10 
     11 namespace mozilla::intl::calendar {
     12 
     13 struct ISODate final {
     14  int32_t year = 0;
     15  int32_t month = 0;
     16  int32_t day = 0;
     17 };
     18 
     19 inline int32_t FloorDiv(int32_t dividend, int32_t divisor) {
     20  int32_t quotient = dividend / divisor;
     21  int32_t remainder = dividend % divisor;
     22  if (remainder < 0) {
     23    quotient -= 1;
     24  }
     25  return quotient;
     26 }
     27 
     28 /**
     29 * Return the day relative to the Unix epoch, January 1 1970.
     30 */
     31 int32_t MakeDay(const ISODate& date);
     32 
     33 }  // namespace mozilla::intl::calendar
     34 
     35 #endif