1

Boost documentation says the following : "Internally boost::gregorian::date is stored as a 32 bit integer type." . I found this from the link : http://www.boost.org/doc/libs/1_56_0/doc/html/date_time/gregorian.html .

How this 32 bit integer is computed? Is it the number of days since epoch (like the way Joda does in Java)?

Daniel Heilper
  • 1,182
  • 2
  • 17
  • 34
Santanu C
  • 1,362
  • 3
  • 20
  • 38

1 Answers1

1

From the documentation, the current implementation supports dates in the range 1400-Jan-01 to 9999-Dec-31

Analyzing the code, the class boost::gregorian::date stores the date as a uint32_t integer named days_. For 1400-Jan-01, this value of this integer is 2232400. Increment one day the date means that this integer is incremented one unit. So, the difference in days between two dates can be calculated just substracting their integers.

J. Calleja
  • 4,855
  • 2
  • 33
  • 54