| Home | Libraries | People | FAQ | More

## Appendices

### Appendix: History

#### Version 1.2.1, February 1, 2012 - 1.49

Fixes:

- #6092 Input from non integral durations makes the compiler fail.
- #6093 [1/3]second fails as valid duration input.
- #6113 duplicate symbol when BOOST_CHRONO_HEADER_ONLY is defined.
- #6243 Sandia-pgi-11.9: more than one instance of overloaded function "min" matches.
- #6257 process_cpu_clock::now() on linux gives time_points 1/1000 times.

#### Version 1.2.0, October 17, 2011 - 1.48

New Features:

- #5979 Added chrono rounding utilities as defined By Howard Hinnant here.
- #5978 Add BOOST_CHRONO_HAS_PROCESS_CLOCKS to know if process clocks are available.
- #5998 Make possible to don't provide hybrid error handling.
- #5906 Take in account the constexpr as defined in the standard.
- #5907 Take in account noexcept for compilers supporting it.

Fixes:

- #5669 Intel compiler failure to compile duration.hpp
- #2114 Enable visibility support (Boost.Chrono part)
- #5909 process_cpu_clock::now() on MAC gives time_points 1/1000 times.
- #5946 Process real cpu clock returns the system steady clock (windows).
- #5974 Process real cpu clock should use clock() instead of times() in MAC which is twice faster and have better resolution.

Cleanup:

- #5975 Reduce the combinations of header-only, shared, static link to reduce test time by 50%.
- #5976 chrono_accuracy_test is not deterministic and should be removed from the regression tests
- #5977 Remove old files from Beman's version. Some old files included in the Beman's version and not documented in the reviewed version that have been definitely removed from the repository as
  - boost/chrono/timer.hpp,
  - boost/chrono/process_times.hpp
  - boost/chrono/detail/process_clock.hpp,
  - boost/chrono/detail/mac/process_clock.hpp,
  - boost/chrono/detail/posix/process_clock.hpp,
  - boost/chrono/detail/win/process_clock.hpp,
  - boost/chrono/detail/run_timer.hpp,
  - boost/chrono/detail/run_timer_static.hpp,

#### Version 1.1.0, Mars 17, 2011 - 1.47

New Features:

- #???? Added time_point unary operators +,-,++,-- and binary operators +`,-` with Rep al RHS.
- #5323 Add Associated type difference_type for chrono::time_point.

Fixes:

- #5322 Explicit default constructed chrono::durations are uninitialized

#### Version 1.0.0, January 6, 2011

- Moved chrono to trunk taking in account the review remarks.
- Documentation revision.

Features:

- Boost_Chrono is now a configurable header-only library version (that also allows the user to choose if the `windows.h` file is included or not).
- Added clock_string<> traits.
- Define chrono-io for all the clocks.
- Add input of process_times representation.

Implementation:

- Use of detail/win files to avoid the use of windows.h file.
- Completed the error_code handling.
- Works now with BOOST_SYSTEM_NO_DEPRECATED.

Fixes:

- Fix some warnings.
- Fix original errors on Mac
- Don't fix the link with boost_system to static.

Test:

- Added test on process and thread clocks.
- Moved to lightweight_test.hpp.
- Able to test multiple configurations.

Doc:

- Removed some not useful parts as the test and the tickets.

### Appendix: Rationale

See N2661 - A Foundation to Sleep On which is very informative and provides motivation for key design decisions. This section contains some extracts from this document.

##### Why duration needs operator%

This operator is convenient for computing where in a time frame a given duration lies. A motivating example is converting a duration into a "broken-down" time duration such as hours::minutes::seconds:

    class ClockTime
    {
        typedef boost::chrono::hours hours;
        typedef boost::chrono::minutes minutes;
        typedef boost::chrono::seconds seconds;
    public:
        hours hours_;
        minutes minutes_;
        seconds seconds_;

        template <class Rep, class Period>
          explicit ClockTime(const boost::chrono::duration<Rep, Period>& d)
            : hours_  (boost::chrono::duration_cast<hours>  (d)),
              minutes_(boost::chrono::duration_cast<minutes>(d % hours(1))),
              seconds_(boost::chrono::duration_cast<seconds>(d % minutes(1)))
              {}
    };

### Appendix: Implementation Notes

##### Which APIs have been chosen to implement each clock on each platform?

The following table presents a resume of which API is uused for each clock on each platform

Table 4.3. Clock API correspondence

Clock | Windows Platform | Posix Platform | Mac Platform
--- | --- | --- | ---
`system_clock` | GetSystemTimeAsFileTime | clock_gettime( CLOCK_REALTIME) | gettimeofday
`steady_clock` | QueryPerformanceCounter and QueryPerformanceFrequency | clock_gettime( CLOCK_STEADY) | mach_timebase_info,mach_absolute_time
`process_real_cpu_clock` | GetProcessTimes | times | times
`process_system_cpu_clock` | GetProcessTimes | times | times
`process_user_cpu_clock` | GetProcessTimes | times | times
`process_cpu_clock` | GetProcessTimes | times | times
`thread_clock` | GetThreadTimes | clock_gettime(pthread_getcpuclockid) | clock_gettime(pthread_getcpuclockid)

### Appendix: FAQ

##### Why does process_cpu_clock sometimes give more cpu seconds than real seconds?

Ask your operating system supplier. The results have been inspected with a debugger, and both for Windows and Linux, that's what the OS appears to be reporting at times.

##### Are integer overflows in the duration arithmetic detected and reported?

Boost.Ratio avoids all kind of overflow that could result of arithmetic operation and that can be simplified. The typedefs durations don't detect overflow. You will need a duration representation that handles overflow.

##### Which clocks should be used to benchmarking?

Each clock has his own features. It depends on what do you need to benchmark. Most of the time, you could be interested in using a thread clock, but if you need to measure code subject to synchronization a process clock would be better. If you have a multi-process application, a system-wide clock could be needed.

##### Which clocks should be used for watching?

For trace purposes, it is probably best to use a system-wide clock.

### Appendix: Acknowledgements

The library's code was derived from Howard Hinnant's time2_demo prototype. Many thanks to Howard for making his code available under the Boost license. The original code was modified by Beman Dawes to conform to Boost conventions.

time2_demo contained this comment:

Much thanks to Andrei Alexandrescu, Walter Brown, Peter Dimov, Jeff Garland, Terry Golubiewski, Daniel Krugler, Anthony Williams.

The file <boost/chrono_io.hpp> has been adapted from the experimental header `<chrono_io>` from Howard Hinnant. Thanks for all Howard.

Howard Hinnant, who is the real author of the library, has provided valuable feedback and suggestions during the development of the library. In particular, The chrono_io_io.hpp source has been adapted from the experimental header `<chrono_io>` from Howard Hinnant.

The acceptance review of Boost.Ratio took place between November 5th and 15th 2010. Many thanks to Anthony Williams, the review manager, and to all the reviewers: David Deakins, John Bytheway, Roland Bock and Paul A. Bristow.

Thanks to Ronald Bock, Andrew Chinoff, Paul A. Bristow and John Bytheway for his help polishing the documentation.

Thanks to Tom Tan for reporting some compiler issues with MSVC V10 beta and MinGW-gcc-4.4.0 and for the many pushing for an homogeneous `process_cpu_clock` clock.

Thanks to Ronald Bock for reporting Valgind issues and for the many suggestions he made concerning the documentation.

### Appendix: Future plans

##### For later releases

- Enhance chrono I/O
  - #5980 Take care of the Howard Hinnant proposal which has the advantage to provide I/O for system clocks using the Gregorian Calendar.
  - #5981 Added i/o state savers.
- Deprecate:
  - chrono I/O: The manipulators duration_short, duration long are depreceated. You should use the parameterized form duration_fmt instead.
  - chrono I/O: The duraction_punc<> facet observers is_short_name, is_long_name are depreceated. You should use is_prefix and is_symbol instead.
  - chrono I/O: The duraction_punc<> facet constructors taking as argument the literals duraction_punc<>::use_long or use short are depreceated. You should use duration_style::prefix and duration_style::symbol instead.
  - chrono I/O: The duraction_punc<> facet constructors taking the long names for seconds, minutes and hours and the associated observers short_name, long_name and name are depreceated. Boost.Chrono allows the user to use an interface that could be customized to take care of locale issues. The default behavior been to return the English words.

When BOOST_CHRONO_IO_V1_DONT_PROVIDE_DEPRECATED is defined the preceding deprecated functions are not available. In addition, the user needs to define the macro BOOST_CHRONO_IO_USES_EXTERNAL_LOCALIZATION to be able to customize the locale interface.

- Include Stopwatches.
- Include chrono::date as defined by Howard Hinnant here.