Is there a library to work with historical (big) dates (eg, 11,043 BC)? Get century, millennium?
For dates and times in general, there's the standard C++11 time classes, and the Glib library offers the GDateTime class, with a C++ binding Glib::DateTime in glibmm. Maybe the Boost libraries have a similar interface too.
If you need historical dates like when there were dinosaurs, you can write your own simple class (unless one of the options I mentioned are good enough, in which case computing the century or millenium by yourself is very easy).
Edit: Most implementations represent time as the number of second or microseconds in Unix time, i.e. since 1970, which means even a 64 bit integer may not be able to represent ancient times (you can try calculating or web-searching or reading on Wikipedia about these limits).
In this case a nice solution can be to use a separate AncientTime class which has just a year, and anything else you need, like month/day/hour can be imlemented by using a simple standrd DateTime class, in which you may ignore the year or keep it normalized to 0 through a thin wrapper.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With