The tick period only has an impact on the behavior of the duration when a conversion between The tick period is represented by a ratio and is encoded into the duration's type, instead of Is floating-point, it can store fractions of a tick to the precision The only data member stored in a duration. The representation stores a count of ticks. The representation is simply any arithmetic type, or an emulation of The six predefined units all use signed integral types as their representation.Īnd they all have a minimum range of ± 292 years. Or it can be a user-defined type which emulates an arithmetic type. This can be any integral type, or even a floating-point Not only can one specify the precision of a duration, one can also specify Units when possible, can be a significant performance advantage. Being able to reduce the sizeof overhead for some Need many hours to cover an extremely large range of time. In Boost.DateTime, hours does not have the same representation Of this utility and flexibility comes at no cost just by making use of Represent it (one third of a second is no problem, and neither is one third Is used to specify the precision, so as long as the precision can be expressedīy a rational constant with respect to seconds, this framework can exactly When doing comparisons or arithmetic between durations of differing precision,Īssuming one wants the comparison and arithmetic to be exact.Ī secondary benefit is that by publishing the class template duration interface, user codeĬan very easily create durations with any precision they Generate any unit, with any precision it needs. The most immediate positive impact is that the library can immediately Has a far reaching positive impact, while not changing the syntax of the That is, in Boost.Chrono all six of the above units are nothingīut typedefs to different instantiations of duration. Unites these units through the class template duration. In Boost.DateTime, these units are united That is, microseconds can always represent This restrictionĮnsures that all conversions are always exact. Only conversionsįrom coarser units to finer units are allowed (in Boost). At this time, unit-specific compile-time conversion constantsĪre used to convert the source unit to the target unit. The only context in which these different types differ is when being converted Each of these units is nothingīut a thin wrapper around a signed integral count. Or waiting to obtain the lock on a mutex. The most common units used when sleeping, waiting on a condition variable, These units were chosen as a subset of the boost library because they are The implementation will eventually work with most C++03 conforming compilers. Thread safe to use a function that modifies the access to a user variable Of exception safety as long as the underlying parameters provide it.Īll functions in the library are thread-unsafe except when noted explicitly.Īs Boost.Chrono doesn't use mutable global variables the thread-safetyĪnalysis is limited to the access to each instance variable. Library you need also to link with the Boost.Systemĭefining BOOST_ERROR_CODE_HEADER_ONLY you will no need to link with itĪs the dependent part is header only then.Īll functions in the library are exception-neutral and provide strong guarantee In addition to link with the Boost.Chrono Howeverīoost.Chrono depends on the non header-only library Boost.System, so thatīoost.System has an undocumented feature (use of macro BOOST_ERROR_CODE_HEADER_ONLY)ĭefined you need to compile it and build the library before use, for exampleįor is_base, is_convertible, common_type. Library defining BOOST_CHRONO_HEADER_ONLY. The simple way is to decompress (or checkout from SVN) the files in yourīoost.Chrono can be configured as a header-only Just go to hereĪnd follow the instructions there for anonymous SVN access. Trunk directories boost/chrono and libs/chrono. You can also access the latest (unstable?) state from the Boost Boost.Chrono is in the latest Boost releaseĭocumentation, tests and examples folder are at boost / libs / chrono /.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |