I'd like to use boost::posix_time::ptime as a 64 bit representation of a datetime with microsecond resolution. I'd also sometimes like to represent a datetime with nanosecond resolution which uses 96 bits.
Unfortunately, it seems like you have to choose one or the other. Why have the boost developers done this via a #define rather than a template parameter? Is there any way to represent both of these types within the one application?
From: http://www.boost.org/doc/libs/1_47_0/doc/html/date_time/details.html#date_time.buildinfo
"To use the alternate resolution (96 bit nanosecond) the variable BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG must be defined in the li开发者_开发百科brary users project files (ie Makefile, Jamfile, etc). This macro is not used by the Gregorian system and therefore has no effect when building the library."
The BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
basically makes the data type use higher precession for the time. Since you need it, use it. I do not see how does,
"I'd like to use boost::posix_time::ptime as a 64 bit representation of a datetime with microsecond resolution,"
come into that. Are you saying that you are using the ptime
type as a binary/on-disk representation of the time?
精彩评论