在 boost:posix_time 中使用纳秒

using nanoseconds with boost:posix_time

我需要纳秒分辨率,我在文档中读到: http://www.boost.org/doc/libs/1_53_0/doc/html/date_time/details.html#date_time.buildinfo

我必须用 BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG 已定义,但我不知道我应该在哪里做,或者语法应该如何。我猜它应该在果酱文件中。我有 boost-build.jamboostcpp.jamproject-config.jam。但是不知道我应该在其中一个文件中写些什么来实现它。

根据您链接的文档(强调我的):

To use the alternate resolution (96 bit nanosecond) the variable BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG must be defined in the library users project files (ie Makefile, Jamfile, etc).

也就是说,如果你在编译项目的时候定义了上述宏就可以了。你不需要重建 boost 本身。