summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/chrono/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/libs/chrono/test
parentInitial commit. (diff)
downloadceph-upstream.tar.xz
ceph-upstream.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/chrono/test')
-rw-r--r--src/boost/libs/chrono/test/Jamfile.v2465
-rw-r--r--src/boost/libs/chrono/test/another_obj.cpp19
-rw-r--r--src/boost/libs/chrono/test/clock.h30
-rw-r--r--src/boost/libs/chrono/test/clock/clock_pass.cpp201
-rw-r--r--src/boost/libs/chrono/test/clock/errored_clock.hpp62
-rw-r--r--src/boost/libs/chrono/test/duration/arithmetic_pass.cpp350
-rw-r--r--src/boost/libs/chrono/test/duration/comparisons_pass.cpp222
-rw-r--r--src/boost/libs/chrono/test/duration/cons/convert_float_to_int_fail.cpp22
-rw-r--r--src/boost/libs/chrono/test/duration/cons/convert_inexact_fail.cpp22
-rw-r--r--src/boost/libs/chrono/test/duration/cons/implicit_constructot_fail.cpp23
-rw-r--r--src/boost/libs/chrono/test/duration/cons/non_implicit_convertible_rep_fail.cpp23
-rw-r--r--src/boost/libs/chrono/test/duration/cons/treat_as_floating_point_Rep2_true_fail.cpp21
-rw-r--r--src/boost/libs/chrono/test/duration/constructor_pass.cpp134
-rw-r--r--src/boost/libs/chrono/test/duration/default_ratio_pass.cpp29
-rw-r--r--src/boost/libs/chrono/test/duration/duration_cast_int_fail.cpp21
-rw-r--r--src/boost/libs/chrono/test/duration/duration_cast_pass.cpp59
-rw-r--r--src/boost/libs/chrono/test/duration/duration_duration_fail.cpp24
-rw-r--r--src/boost/libs/chrono/test/duration/duration_values_pass.cpp76
-rw-r--r--src/boost/libs/chrono/test/duration/nonmember/divide_rep2_fail.cpp22
-rw-r--r--src/boost/libs/chrono/test/duration/nonmember/modulus_rep2_fail.cpp22
-rw-r--r--src/boost/libs/chrono/test/duration/nonmember/times_rep2_lhs_fail.cpp22
-rw-r--r--src/boost/libs/chrono/test/duration/nonmember/times_rep2_rhs_fail.cpp22
-rw-r--r--src/boost/libs/chrono/test/duration/positive_num_fail.cpp23
-rw-r--r--src/boost/libs/chrono/test/duration/ratio_alias_pass.cpp29
-rw-r--r--src/boost/libs/chrono/test/duration/ratio_fail.cpp23
-rw-r--r--src/boost/libs/chrono/test/duration/rounding_pass.cpp105
-rw-r--r--src/boost/libs/chrono/test/duration/typedefs_pass.cpp42
-rw-r--r--src/boost/libs/chrono/test/duration/types_pass.cpp28
-rw-r--r--src/boost/libs/chrono/test/intmax_c.cpp19
-rw-r--r--src/boost/libs/chrono/test/io/duration_input.cpp124
-rw-r--r--src/boost/libs/chrono/test/io/duration_output.cpp114
-rw-r--r--src/boost/libs/chrono/test/io/time_point_input.cpp238
-rw-r--r--src/boost/libs/chrono/test/io/time_point_output.cpp317
-rw-r--r--src/boost/libs/chrono/test/one_obj.cpp23
-rw-r--r--src/boost/libs/chrono/test/rep.h67
-rw-r--r--src/boost/libs/chrono/test/run_timer_test.cpp226
-rw-r--r--src/boost/libs/chrono/test/test_10631.cpp61
-rw-r--r--src/boost/libs/chrono/test/test_10778.cpp19
-rw-r--r--src/boost/libs/chrono/test/test_11006.cpp21
-rw-r--r--src/boost/libs/chrono/test/test_11012.cpp27
-rw-r--r--src/boost/libs/chrono/test/test_12176.cpp11
-rw-r--r--src/boost/libs/chrono/test/test_7868.cpp81
-rw-r--r--src/boost/libs/chrono/test/test_9337.cpp27
-rw-r--r--src/boost/libs/chrono/test/time_point/arithmetic_ext_pass.cpp70
-rw-r--r--src/boost/libs/chrono/test/time_point/arithmetic_pass.cpp151
-rw-r--r--src/boost/libs/chrono/test/time_point/comparisons/equal_fail.cpp32
-rw-r--r--src/boost/libs/chrono/test/time_point/comparisons/less_fail.cpp32
-rw-r--r--src/boost/libs/chrono/test/time_point/comparisons_pass.cpp146
-rw-r--r--src/boost/libs/chrono/test/time_point/cons/implicit_fail.cpp23
-rw-r--r--src/boost/libs/chrono/test/time_point/cons/non_implicit_convertible_duration_fail.cpp27
-rw-r--r--src/boost/libs/chrono/test/time_point/constructor_pass.cpp80
-rw-r--r--src/boost/libs/chrono/test/time_point/default_duration.pass.cpp24
-rw-r--r--src/boost/libs/chrono/test/time_point/default_duration_pass.cpp24
-rw-r--r--src/boost/libs/chrono/test/time_point/duration.fail.cpp22
-rw-r--r--src/boost/libs/chrono/test/time_point/min_max_pass.cpp34
-rw-r--r--src/boost/libs/chrono/test/time_point/not_duration_fail.cpp22
-rw-r--r--src/boost/libs/chrono/test/time_point/time_point_cast_int_fail.cpp24
-rw-r--r--src/boost/libs/chrono/test/time_point/time_point_cast_pass.cpp67
-rw-r--r--src/boost/libs/chrono/test/traits/common_type_duration_pass.cpp43
-rw-r--r--src/boost/libs/chrono/test/traits/common_type_time_point_pass.cpp47
-rw-r--r--src/boost/libs/chrono/test/traits/duration_values_pass.cpp41
-rw-r--r--src/boost/libs/chrono/test/traits/treat_as_floating_point_pass.cpp41
-rw-r--r--src/boost/libs/chrono/test/win32_test.cpp149
63 files changed, 4615 insertions, 0 deletions
diff --git a/src/boost/libs/chrono/test/Jamfile.v2 b/src/boost/libs/chrono/test/Jamfile.v2
new file mode 100644
index 000000000..7565d27b3
--- /dev/null
+++ b/src/boost/libs/chrono/test/Jamfile.v2
@@ -0,0 +1,465 @@
+# Boost Chrono Library test Jamfile
+
+# Copyright Beman Dawes 2008
+# Copyright Vicente J. Botet Escriba 2009-2010
+
+# Distributed under the Boost Software License, Version 1.0.
+# See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt
+
+# See library home page at http://www.boost.org/libs/chrono
+
+import testing ;
+import os ;
+import feature ;
+
+project
+ : requirements
+ <target-os>freebsd:<linkflags>"-lrt"
+ <target-os>linux:<linkflags>"-lrt -lpthread"
+ <toolset>clang/<target-os>linux:<linkflags>"-lpthread"
+ <toolset>pgi:<linkflags>"-lrt"
+ #<threading>single:<define>BOOST_CHRONO_THREAD_DISABLED
+ <toolset>msvc:<asynch-exceptions>on
+ <define>BOOST_CHRONO_USES_MPL_ASSERT
+ #<toolset>sun:<define>BOOST_COMMON_TYPE_DONT_USE_TYPEOF
+ #<toolset>sun:<define>BOOST_TYPEOF_EMULATION
+ <toolset>sun:<define>__typeof__=__typeof__
+ <warnings>all
+ <toolset>gcc:<cxxflags>-Wextra
+ #<toolset>gcc:<cxxflags>-pedantic
+ <toolset>clang:<warnings>on
+ <toolset>gcc:<cxxflags>-Wno-long-long
+ <toolset>gcc:<cxxflags>-Wno-variadic-macros
+ <toolset>darwin:<cxxflags>-Wextra
+ <toolset>darwin:<cxxflags>-pedantic
+ <toolset>darwin:<cxxflags>-Wno-long-long
+ <toolset>darwin:<cxxflags>-Wno-variadic-macros
+ #<toolset>pathscale:<cxxflags>-Wextra
+ <toolset>pathscale:<cxxflags>-Wno-long-long
+ <toolset>pathscale:<cxxflags>-pedantic
+ <toolset>clang:<cxxflags>-Wextra
+ <toolset>clang:<cxxflags>-pedantic
+ <toolset>clang:<cxxflags>-Wno-long-long
+ <toolset>clang:<cxxflags>-Wno-variadic-macros
+ <toolset>gcc-4.5.0,<target-os>windows:<cxxflags>-Wno-missing-field-initializers
+ <toolset>gcc-4.5.0,<target-os>windows:<cxxflags>-fdiagnostics-show-option
+ <toolset>msvc:<cxxflags>/wd4127
+ <toolset>msvc:<cxxflags>/wd4512
+# Note: Some of the remarks from the Intel compiler are disabled
+# remark #193: zero used for undefined preprocessing identifier "XXX"
+# remark #304: access control not specified ("public" by default)
+# remark #383: value copied to temporary, reference to temporary used
+# remark #444: destructor for base class "XXX" (declared at line YYY") is not virtual
+# remark #593: variable "XXX" was set but never used
+# remark #981: operands are evaluated in unspecified order
+# remark #1418: external function definition with no prior declaration
+# remark #2415: variable "XXX" of static storage duration was declared but never referenced
+
+ <toolset>intel:<cxxflags>-wd193,304,383,444
+ <toolset>intel:<cxxflags>-wd593,981
+ <toolset>intel:<cxxflags>-wd1418
+ <toolset>intel:<cxxflags>-wd2415
+ ;
+
+rule chrono-run ( sources )
+{
+ return
+ [ run $(sources) ../build//boost_chrono
+ : :
+ :
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_d ]
+ #[ run $(sources) ../build//boost_chrono/<link>static
+ # : :
+ # :
+ # : $(sources[1]:B)_s ]
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_h ]
+ ;
+}
+
+rule chrono-runXXX ( sources )
+{
+ return
+ [ run $(sources) ../build//boost_chrono
+ : :
+ :
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_d ]
+ #[ run $(sources) ../build//boost_chrono/<link>static
+ # : :
+ # :
+ # : $(sources[1]:B)_s ]
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ <define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_h ]
+ ;
+}
+
+
+rule chrono-v1-v2-run ( sources )
+{
+ return
+ [ run $(sources) ../build//boost_chrono
+ : :
+ :
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_d ]
+ [ run $(sources) ../build//boost_chrono/<link>static
+ : :
+ :
+ : v1_$(sources[1]:B)_s ]
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_h ]
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ #<define>BOOST_CHRONO_VERSION=1
+ : v1_$(sources[1]:B)_h ]
+ ;
+}
+
+rule chrono-run2 ( sources : name )
+{
+ return
+ [ run $(sources) ../build//boost_chrono
+ : :
+ :
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_d ]
+ #[ run $(sources) ../build//boost_chrono/<link>static
+ # : :
+ # :
+ # : $(name)_s ]
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_h ]
+ ;
+}
+
+rule date-run ( sources + )
+{
+ return
+ [ run $(sources) ../build//boost_chrono
+ : :
+ :
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_d ]
+ ;
+}
+
+rule date-run-2 ( sources + : name )
+{
+ return
+ [ run $(sources) ../build//boost_chrono
+ : :
+ :
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_d ]
+ ;
+}
+
+
+rule chrono-run-mt ( sources )
+{
+ return
+ [ run $(sources) ../build//boost_chrono
+ : :
+ :
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_d ]
+ #[ run $(sources) ../build//boost_chrono/<link>static
+ # : :
+ # :
+ # : $(sources[1]:B)_s ]
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_h ]
+ ;
+}
+rule chrono-run2-mt ( sources * : name )
+{
+ return
+ [ run $(sources) ../build//boost_chrono
+ : :
+ :
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_d ]
+ #[ run $(sources) ../build//boost_chrono/<link>static
+ # : :
+ # :
+ # : $(name)_s ]
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_h ]
+ ;
+}
+
+rule chrono-run-check ( sources )
+{
+ return
+ [ run $(sources)
+ : :
+ :
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_d ]
+ [ run $(sources)
+ : :
+ :
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_s ]
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_h ]
+ ;
+}
+
+rule chrono-run-check2 ( sources : name )
+{
+ return
+ [ run $(sources)
+ : :
+ :
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_d ]
+ [ run $(sources)
+ : :
+ :
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_s ]
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_h ]
+ ;
+}
+
+rule chrono-run-header ( sources )
+{
+ return
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_h ]
+ ;
+}
+
+rule chrono-v1-v2-run-header ( sources )
+{
+ return
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_h ]
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ : v1_$(sources[1]:B)_h ]
+ ;
+}
+
+rule chrono-run-header2 ( sources : name )
+{
+ return
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_h ]
+ ;
+}
+
+rule chrono-compile ( sources )
+{
+ return
+ [ compile $(sources)
+ :
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_l ]
+ [ compile $(sources)
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_h ]
+ ;
+}
+
+rule chrono-compile2 ( sources : name )
+{
+ return
+ [ compile $(sources)
+ :
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_l ]
+ [ compile $(sources)
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_h ]
+ ;
+}
+
+
+ test-suite "examples"
+ :
+ [ chrono-run-header ../example/cycle_count.cpp ]
+ [ chrono-run-header ../example/runtime_resolution.cpp ]
+ [ chrono-run-header ../example/xtime.cpp ]
+ [ chrono-run-header ../example/saturating.cpp ]
+ [ chrono-run ../example/min_time_point.cpp ]
+ [ chrono-run-header ../example/i_dont_like_the_default_duration_behavior.cpp ]
+ [ chrono-run ../example/simulated_thread_interface_demo.cpp ]
+ [ chrono-run-header ../example/timeval_demo.cpp ]
+ [ chrono-run ../example/chrono_unit_test.cpp ]
+ [ chrono-run-header ../example/explore_limits.cpp ]
+ [ chrono-run-header ../example/test_duration.cpp ]
+ [ chrono-run ../example/test_clock.cpp ]
+ [ chrono-run-header ../example/miscellaneous.cpp ]
+ [ chrono-run-header ../example/test_special_values.cpp ]
+ [ chrono-run ../example/manipulate_clock_object.cpp ]
+ [ chrono-run-mt ../example/test_thread_clock.cpp ]
+ [ chrono-run-header ../example/rounding.cpp ]
+ #[ chrono-run ../example/await_keystroke.cpp ]
+ ;
+
+ test-suite "traits"
+ :
+ [ chrono-compile2 traits/common_type_duration_pass.cpp : traits_common_type_duration_p ]
+ [ chrono-compile2 traits/common_type_time_point_pass.cpp : traits_common_type_time_point_p ]
+ [ chrono-compile2 traits/treat_as_floating_point_pass.cpp : traits_treat_as_floating_point_p ]
+ [ chrono-run-header2 traits/duration_values_pass.cpp : traits_duration_values_p ]
+ ;
+
+ test-suite "duration"
+ :
+ [ compile-fail duration/duration_duration_fail.cpp ]
+ [ compile-fail duration/ratio_fail.cpp ]
+ [ compile-fail duration/positive_num_fail.cpp ]
+ [ chrono-compile duration/default_ratio_pass.cpp ]
+ [ chrono-compile duration/types_pass.cpp ]
+ [ chrono-compile duration/ratio_alias_pass.cpp ]
+ [ chrono-compile duration/typedefs_pass.cpp ]
+ [ chrono-run-header duration/arithmetic_pass.cpp ]
+ [ chrono-run-header duration/duration_cast_pass.cpp ]
+ [ compile-fail duration/duration_cast_int_fail.cpp ]
+ [ chrono-run-header duration/comparisons_pass.cpp ]
+ [ chrono-run-header duration/constructor_pass.cpp ]
+ [ compile-fail duration/cons/convert_float_to_int_fail.cpp ]
+ [ compile-fail duration/cons/convert_inexact_fail.cpp ]
+ [ compile-fail duration/cons/implicit_constructot_fail.cpp ]
+ [ compile-fail duration/cons/non_implicit_convertible_rep_fail.cpp ]
+ [ compile-fail duration/cons/treat_as_floating_point_Rep2_true_fail.cpp ]
+ [ compile-fail duration/nonmember/divide_rep2_fail.cpp ]
+ [ compile-fail duration/nonmember/modulus_rep2_fail.cpp ]
+ [ compile-fail duration/nonmember/times_rep2_lhs_fail.cpp ]
+ [ compile-fail duration/nonmember/times_rep2_rhs_fail.cpp ]
+ [ chrono-run-header duration/duration_values_pass.cpp ]
+ [ chrono-run-header duration/rounding_pass.cpp ]
+ ;
+
+ test-suite "time_point"
+ :
+ [ chrono-compile2 time_point/default_duration_pass.cpp : time_point_default_duration_p ]
+ [ compile-fail time_point/not_duration_fail.cpp : : time_point_not_duration_f ]
+ [ chrono-run-header2 time_point/arithmetic_pass.cpp : time_point_arithmetic_p ]
+ [ chrono-run-header2 time_point/arithmetic_ext_pass.cpp : time_point_arithmetic_ext_p ]
+ [ chrono-run-header2 time_point/time_point_cast_pass.cpp : time_point_time_point_cast_p ]
+ [ compile-fail time_point/time_point_cast_int_fail.cpp : : time_point_time_point_cast_int_f ]
+ [ chrono-run-header2 time_point/comparisons_pass.cpp : time_point_comparisons_p ]
+ [ compile-fail time_point/comparisons/equal_fail.cpp : : time_point_equal_f ]
+ [ compile-fail time_point/comparisons/less_fail.cpp : : time_point_less_f ]
+ [ chrono-run-header2 time_point/constructor_pass.cpp : time_point_constructor_p ]
+ [ compile-fail time_point/cons/implicit_fail.cpp : : time_point_implicit_f ]
+ [ compile-fail time_point/cons/non_implicit_convertible_duration_fail.cpp : : time_point_non_implicit_convertible_duration_f ]
+ [ chrono-run-header2 time_point/min_max_pass.cpp : time_point_min_max_p ]
+ ;
+
+ test-suite "clock"
+ :
+ [ chrono-run2-mt clock/clock_pass.cpp : clock_clock_p ]
+ [ chrono-run2-mt one_obj.cpp another_obj.cpp : two_obj_p ]
+ ;
+
+ test-suite "io_ex"
+ :
+ [ chrono-v1-v2-run ../example/io_ex1.cpp ]
+ [ chrono-v1-v2-run-header ../example/io_ex2.cpp ]
+ [ chrono-v1-v2-run ../example/io_ex3.cpp ]
+ [ chrono-v1-v2-run ../example/io_ex4.cpp ]
+ [ chrono-v1-v2-run ../example/io_ex5.cpp ]
+ [ chrono-v1-v2-run ../example/french.cpp ]
+ ;
+
+ test-suite "io"
+ :
+ [ chrono-v1-v2-run-header io/duration_input.cpp ]
+ [ chrono-v1-v2-run-header io/duration_output.cpp ]
+ [ chrono-v1-v2-run-header io/time_point_input.cpp ]
+ [ chrono-v1-v2-run-header io/time_point_output.cpp ]
+ [ chrono-run test_7868.cpp ]
+ [ chrono-run test_11006.cpp ]
+ [ chrono-run test_11012.cpp ]
+ [ chrono-runXXX test_12176.cpp ]
+ ;
+
+ test-suite "win32"
+ :
+ [ chrono-run win32_test.cpp ]
+ ;
+
+ explicit ts_ ;
+ test-suite ts_
+ :
+ #[ chrono-run test_7868.cpp ]
+ #[ chrono-run test_9337.cpp ]
+ #[ chrono-run test_10778.cpp ]
+ [ chrono-run test_10631.cpp ]
+ ;
+
diff --git a/src/boost/libs/chrono/test/another_obj.cpp b/src/boost/libs/chrono/test/another_obj.cpp
new file mode 100644
index 000000000..8ebf67720
--- /dev/null
+++ b/src/boost/libs/chrono/test/another_obj.cpp
@@ -0,0 +1,19 @@
+// boost win32_test.cpp -----------------------------------------------------//
+
+// Copyright 2010 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// See http://www.boost.org/libs/chrono for documentation.
+#include <iostream>
+#include <boost/chrono/chrono.hpp>
+#include <boost/chrono/chrono_io.hpp>
+
+void another() {
+ boost::chrono::steady_clock::time_point t1=boost::chrono::steady_clock::now();
+ boost::chrono::steady_clock::time_point t2=boost::chrono::steady_clock::now();
+ std::cout << t2-t1 << std::endl;
+ return ;
+}
+
diff --git a/src/boost/libs/chrono/test/clock.h b/src/boost/libs/chrono/test/clock.h
new file mode 100644
index 000000000..3fd8eb55b
--- /dev/null
+++ b/src/boost/libs/chrono/test/clock.h
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#ifndef CLOCK_H
+#define CLOCK_H
+
+#include <boost/chrono/chrono.hpp>
+
+class Clock
+{
+ typedef boost::chrono::nanoseconds duration;
+ typedef duration::rep rep;
+ typedef duration::period period;
+ typedef boost::chrono::time_point<Clock, duration> time_point;
+ static const bool is_steady = false;
+
+ static time_point now();
+};
+
+#endif // CLOCK_H
diff --git a/src/boost/libs/chrono/test/clock/clock_pass.cpp b/src/boost/libs/chrono/test/clock/clock_pass.cpp
new file mode 100644
index 000000000..d19db1667
--- /dev/null
+++ b/src/boost/libs/chrono/test/clock/clock_pass.cpp
@@ -0,0 +1,201 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Copyright (c) Microsoft Corporation 2014
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/type_traits/is_same.hpp>
+#include <boost/chrono/chrono.hpp>
+#include <boost/chrono/process_cpu_clocks.hpp>
+#include <boost/chrono/thread_clock.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+template <typename Clock>
+void check_clock_invariants()
+{
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<typename Clock::rep, typename Clock::duration::rep>::value), NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<typename Clock::period, typename Clock::duration::period>::value), NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<typename Clock::duration, typename Clock::time_point::duration>::value), NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT(Clock::is_steady || !Clock::is_steady, NOTHING, ());
+ // to be replaced by has static member bool is_steady
+}
+
+template <typename Clock>
+void check_clock_now()
+{
+ typename Clock::time_point t1 = Clock::now();
+ (void)t1;
+}
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+
+template <typename Clock>
+void check_clock_now_ec()
+{
+ boost::system::error_code ec;
+ typename Clock::time_point t1 = Clock::now(ec);
+ (void)t1;
+ BOOST_TEST(ec.value()==0);
+}
+
+template <typename Clock>
+void check_clock_now_throws()
+{
+ typename Clock::time_point t1 = Clock::now(boost::throws());
+ (void)t1;
+}
+
+#ifndef BOOST_NO_EXCEPTIONS
+
+template <typename Clock>
+void check_clock_now_err(int err)
+{
+ Clock::set_errno(err);
+ try {
+ typename Clock::time_point t1 = Clock::now();
+ } catch (boost::system::system_error& ex) {
+ BOOST_TEST(ex.code().value()==err);
+// BOOST_TEST(ex.code().category() == ::boost::system::system_category());
+// BOOST_TEST(std::string(ex.what()) == std::string("errored_clock"));
+ }
+ Clock::set_errno(0);
+}
+#endif
+
+template <typename Clock>
+void check_clock_now_ec_err(int err)
+{
+ Clock::set_errno(err);
+ boost::system::error_code ec;
+ typename Clock::time_point t1 = Clock::now(ec);
+ BOOST_TEST(ec.value()==err);
+// BOOST_TEST(ec.category() == ::boost::system::system_category());
+ Clock::set_errno(0);
+}
+
+#ifndef BOOST_NO_EXCEPTIONS
+template <typename Clock>
+void check_clock_now_throws_err(int err)
+{
+ Clock::set_errno(err);
+ try {
+ typename Clock::time_point t1 = Clock::now(boost::throws());
+ BOOST_TEST(0&&"exception not thown");
+ } catch (boost::system::system_error& ex) {
+ BOOST_TEST(ex.code().value()==err);
+// BOOST_TEST(ex.code().category() == ::boost::system::system_category());
+// BOOST_TEST(std::string(ex.what()) == std::string("errored_clock"));
+ }
+ Clock::set_errno(0);
+}
+#endif
+#endif
+
+int main()
+{
+ check_clock_invariants<boost::chrono::high_resolution_clock>();
+ check_clock_now<boost::chrono::high_resolution_clock>();
+
+#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
+ check_clock_invariants<boost::chrono::steady_clock>();
+ BOOST_CHRONO_STATIC_ASSERT(boost::chrono::steady_clock::is_steady, NOTHING, ());
+ check_clock_now<boost::chrono::steady_clock>();
+#endif
+
+ check_clock_invariants<boost::chrono::system_clock>();
+ BOOST_CHRONO_STATIC_ASSERT(!boost::chrono::system_clock::is_steady, NOTHING, ());
+ check_clock_now<boost::chrono::system_clock>();
+ {
+ typedef boost::chrono::system_clock C;
+ C::time_point t1 = C::from_time_t(C::to_time_t(C::now()));
+ (void)t1;
+ }
+ {
+ typedef boost::chrono::system_clock C;
+ std::time_t t1 = C::to_time_t(C::now());
+ (void)t1;
+
+ }
+ {
+ BOOST_TEST((boost::chrono::system_clock::duration::min)() <
+ boost::chrono::system_clock::duration::zero());
+
+ }
+
+#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
+ check_clock_invariants<boost::chrono::thread_clock>();
+ BOOST_CHRONO_STATIC_ASSERT(boost::chrono::thread_clock::is_steady, NOTHING, ());
+ check_clock_now<boost::chrono::thread_clock>();
+#endif
+
+#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
+ check_clock_invariants<boost::chrono::process_real_cpu_clock>();
+ BOOST_CHRONO_STATIC_ASSERT(boost::chrono::process_real_cpu_clock::is_steady, NOTHING, ());
+ check_clock_now<boost::chrono::process_real_cpu_clock>();
+
+#if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
+ check_clock_invariants<boost::chrono::process_user_cpu_clock>();
+ BOOST_CHRONO_STATIC_ASSERT(boost::chrono::process_user_cpu_clock::is_steady, NOTHING, ());
+ check_clock_now<boost::chrono::process_user_cpu_clock>();
+
+ check_clock_invariants<boost::chrono::process_system_cpu_clock>();
+ BOOST_CHRONO_STATIC_ASSERT(boost::chrono::process_system_cpu_clock::is_steady, NOTHING, ());
+ check_clock_now<boost::chrono::process_system_cpu_clock>();
+
+ check_clock_invariants<boost::chrono::process_cpu_clock>();
+ BOOST_CHRONO_STATIC_ASSERT(boost::chrono::process_cpu_clock::is_steady, NOTHING, ());
+ check_clock_now<boost::chrono::process_cpu_clock>();
+#endif
+#endif
+
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ check_clock_now_ec<boost::chrono::high_resolution_clock>();
+ check_clock_now_throws<boost::chrono::high_resolution_clock>();
+
+#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
+ check_clock_now_ec<boost::chrono::steady_clock>();
+ check_clock_now_throws<boost::chrono::steady_clock>();
+#endif
+
+ check_clock_now_ec<boost::chrono::system_clock>();
+ check_clock_now_throws<boost::chrono::system_clock>();
+
+#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
+ check_clock_now_ec<boost::chrono::thread_clock>();
+ check_clock_now_throws<boost::chrono::thread_clock>();
+#endif
+
+#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
+ check_clock_now_ec<boost::chrono::process_real_cpu_clock>();
+ check_clock_now_throws<boost::chrono::process_real_cpu_clock>();
+
+#if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
+ check_clock_now_ec<boost::chrono::process_user_cpu_clock>();
+ check_clock_now_throws<boost::chrono::process_user_cpu_clock>();
+
+ check_clock_now_ec<boost::chrono::process_system_cpu_clock>();
+ check_clock_now_throws<boost::chrono::process_system_cpu_clock>();
+
+ check_clock_now_ec<boost::chrono::process_cpu_clock>();
+ check_clock_now_throws<boost::chrono::process_cpu_clock>();
+#endif
+#endif
+
+#endif
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/chrono/test/clock/errored_clock.hpp b/src/boost/libs/chrono/test/clock/errored_clock.hpp
new file mode 100644
index 000000000..d9e80e87a
--- /dev/null
+++ b/src/boost/libs/chrono/test/clock/errored_clock.hpp
@@ -0,0 +1,62 @@
+// errored_clock.hpp --------------------------------------------------------------//
+
+// Copyright 2010 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#ifndef BOOST_CHRONO_ERRORED_CLOCKS_HPP
+#define BOOST_CHRONO_ERRORED_CLOCKS_HPP
+
+#include <boost/chrono/config.hpp>
+#include <boost/chrono/duration.hpp>
+#include <boost/chrono/time_point.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/chrono/detail/system.hpp>
+
+ class errored_clock
+ {
+ public:
+ typedef boost::chrono::nanoseconds duration;
+ typedef duration::rep rep;
+ typedef duration::period period;
+ typedef boost::chrono::time_point<errored_clock> time_point;
+ static const bool is_steady = true;
+ static int errno_;
+
+ static void set_errno(int err) {
+ errno_=err;
+ }
+
+ // throws on error
+ static time_point now() {
+ boost::throw_exception(
+ boost::system::system_error(
+ errno_,
+ ::boost::system::system_category(),
+ "errored_clock"
+ )
+ );
+ return time_point();
+ }
+ // never throws and set ec
+ static time_point now(boost::system::error_code & ec) {
+ if (::boost::chrono::is_throws(ec))
+ {
+ boost::throw_exception(
+ boost::system::system_error(
+ errno_,
+ ::boost::system::system_category(),
+ "errored_clock"
+ )
+ );
+ }
+ ec.assign( errno_, ::boost::system::system_category() );
+ return time_point();
+ };
+ };
+ int errored_clock::errno_;
+
+#endif
diff --git a/src/boost/libs/chrono/test/duration/arithmetic_pass.cpp b/src/boost/libs/chrono/test/duration/arithmetic_pass.cpp
new file mode 100644
index 000000000..521ca644d
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/arithmetic_pass.cpp
@@ -0,0 +1,350 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/duration.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#ifdef BOOST_NO_CXX11_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
+
+int main()
+{
+ // Default construct
+ {
+ //BOOST_CONSTEXPR
+ boost::chrono::minutes m;
+ //BOOST_CONSTEXPR_ASSERT(m.count() == 0);
+ (void)m;
+ }
+
+ // UNARY PLUS
+ {
+ boost::chrono::minutes m(3);
+ boost::chrono::minutes m2 = +m;
+ BOOST_TEST(m.count() == m2.count());
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::minutes m(3);
+ BOOST_CONSTEXPR boost::chrono::minutes m2(+m);
+ BOOST_CONSTEXPR_ASSERT(m.count() == m2.count());
+ }
+
+ // UNARY MINUS
+ {
+ boost::chrono::minutes m(3);
+ boost::chrono::minutes m2 = -m;
+ BOOST_TEST(m2.count() == -m.count());
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::minutes m(3);
+ BOOST_CONSTEXPR boost::chrono::minutes m2 = -m;
+ BOOST_CONSTEXPR_ASSERT(m2.count() == -m.count());
+ }
+ // PRE INCREMENT
+ {
+ boost::chrono::hours h(3);
+ boost::chrono::hours& href = ++h;
+ BOOST_TEST(&href == &h);
+ BOOST_TEST(h.count() == 4);
+ }
+ // POST INCREMENT
+ {
+ boost::chrono::hours h(3);
+ boost::chrono::hours h2 = h++;
+ BOOST_TEST(h.count() == 4);
+ BOOST_TEST(h2.count() == 3);
+ }
+ // PRE DECREMENT
+ {
+ boost::chrono::hours h(3);
+ boost::chrono::hours& href = --h;
+ BOOST_TEST(&href == &h);
+ BOOST_TEST(h.count() == 2);
+ }
+ // POST DECREMENT
+ {
+ boost::chrono::hours h(3);
+ boost::chrono::hours h2 = h--;
+ BOOST_TEST(h.count() == 2);
+ BOOST_TEST(h2.count() == 3);
+ }
+ // PLUS ASSIGN
+ {
+ boost::chrono::seconds s(3);
+ s += boost::chrono::seconds(2);
+ BOOST_TEST(s.count() == 5);
+ s += boost::chrono::minutes(2);
+ BOOST_TEST(s.count() == 125);
+ }
+ // MINUS ASSIGN
+ {
+ boost::chrono::seconds s(3);
+ s -= boost::chrono::seconds(2);
+ BOOST_TEST(s.count() == 1);
+ s -= boost::chrono::minutes(2);
+ BOOST_TEST(s.count() == -119);
+ }
+ // TIMES ASSIGN
+ {
+ boost::chrono::nanoseconds ns(3);
+ ns *= 5;
+ BOOST_TEST(ns.count() == 15);
+ }
+ // DIVIDE ASSIGN
+ {
+ boost::chrono::nanoseconds ns(15);
+ ns /= 5;
+ BOOST_TEST(ns.count() == 3);
+ }
+ // MODULUS ASSIGN duration
+ {
+ boost::chrono::microseconds us(11);
+ boost::chrono::microseconds us2(3);
+ us %= us2;
+ BOOST_TEST(us.count() == 2);
+ us %= boost::chrono::milliseconds(3);
+ BOOST_TEST(us.count() == 2);
+ }
+ // MODULUS ASSIGN Rep
+ {
+ boost::chrono::microseconds us(11);
+ us %= 3;
+ BOOST_TEST(us.count() == 2);
+ }
+ // PLUS
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(5);
+ boost::chrono::seconds r = s1 + s2;
+ BOOST_TEST(r.count() == 8);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::seconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::seconds s2(5);
+ BOOST_CONSTEXPR boost::chrono::seconds r = s1 + s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == 8);
+ }
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::microseconds s2(5);
+ boost::chrono::microseconds r = s1 + s2;
+ BOOST_TEST(r.count() == 3000005);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::seconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::microseconds s2(5);
+ BOOST_CONSTEXPR boost::chrono::microseconds r = s1 + s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == 3000005);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
+ boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 + s2;
+ BOOST_TEST(r.count() == 75);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 + s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == 75);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
+ boost::chrono::duration<double, boost::ratio<1, 15> > r = s1 + s2;
+ BOOST_TEST(r.count() == 75);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<1, 15> > r = s1 + s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == 75);
+ }
+
+ // MINUS
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(5);
+ boost::chrono::seconds r = s1 - s2;
+ BOOST_TEST(r.count() == -2);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::seconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::seconds s2(5);
+ BOOST_CONSTEXPR boost::chrono::seconds r = s1 - s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == -2);
+ }
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::microseconds s2(5);
+ boost::chrono::microseconds r = s1 - s2;
+ BOOST_TEST(r.count() == 2999995);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::seconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::microseconds s2(5);
+ BOOST_CONSTEXPR boost::chrono::microseconds r = s1 - s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == 2999995);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
+ boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 - s2;
+ BOOST_TEST(r.count() == -15);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 - s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == -15);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
+ boost::chrono::duration<double, boost::ratio<1, 15> > r = s1 - s2;
+ BOOST_TEST(r.count() == -15);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<1, 15> > r = s1 - s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == -15);
+ }
+
+ // TIMES rep
+ {
+ boost::chrono::nanoseconds ns(3);
+ boost::chrono::nanoseconds ns2 = ns * 5;
+ BOOST_TEST(ns2.count() == 15);
+ boost::chrono::nanoseconds ns3 = 6 * ns2;
+ BOOST_TEST(ns3.count() == 90);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns(3);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns2 = ns * 5;
+ BOOST_CONSTEXPR_ASSERT(ns2.count() == 15);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns3 = 6 * ns2;
+ BOOST_CONSTEXPR_ASSERT(ns3.count() == 90);
+ }
+
+ // DIVIDE duration
+ {
+ boost::chrono::nanoseconds ns1(15);
+ boost::chrono::nanoseconds ns2(5);
+ BOOST_TEST(ns1 / ns2 == 3);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns1(15);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns2(5);
+ BOOST_CONSTEXPR_ASSERT(ns1 / ns2 == 3);
+ }
+ {
+ boost::chrono::microseconds us1(15);
+ boost::chrono::nanoseconds ns2(5);
+ BOOST_TEST(us1 / ns2 == 3000);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::microseconds us1(15);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns2(5);
+ BOOST_CONSTEXPR_ASSERT(us1 / ns2 == 3000);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(30);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
+ BOOST_TEST(s1 / s2 == 6);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(30);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
+ BOOST_CONSTEXPR_ASSERT(s1 / s2 == 6);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(30);
+ boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
+ //BOOST_TEST(s1 / s2 == 20. / 3);
+ BOOST_TEST(3 * s1 == 20 * s2);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(30);
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
+ //BOOST_CONSTEXPR_ASSERT(s1 / s2 == 20. / 3);
+ BOOST_TEST(3 * s1 == 20 * s2);
+ }
+ // DIVIDE rep
+ {
+ boost::chrono::nanoseconds ns(15);
+ boost::chrono::nanoseconds ns2 = ns / 5;
+ BOOST_TEST(ns2.count() == 3);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns(15);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns2 = ns / 5;
+ BOOST_CONSTEXPR_ASSERT(ns2.count() == 3);
+ }
+
+ // MODULUS duration
+
+ {
+ boost::chrono::nanoseconds ns1(15);
+ boost::chrono::nanoseconds ns2(6);
+ boost::chrono::nanoseconds r = ns1 % ns2;
+ BOOST_TEST(r.count() == 3);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns1(15);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns2(6);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds r = ns1 % ns2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == 3);
+ }
+ {
+ boost::chrono::microseconds us1(15);
+ boost::chrono::nanoseconds ns2(28);
+ boost::chrono::nanoseconds r = us1 % ns2;
+ BOOST_TEST(r.count() == 20);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::microseconds us1(15);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns2(28);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds r = us1 % ns2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == 20);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<3, 5> > s1(6);
+ boost::chrono::duration<int, boost::ratio<2, 3> > s2(3);
+ boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 % s2;
+ BOOST_TEST(r.count() == 24);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s1(6);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s2(3);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 % s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == 24);
+ }
+ // MODULUS rep
+ {
+ boost::chrono::nanoseconds ns(15);
+ boost::chrono::nanoseconds ns2 = ns % 6;
+ BOOST_TEST(ns2.count() == 3);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns(15);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns2 = ns % 6;
+ BOOST_CONSTEXPR_ASSERT(ns2.count() == 3);
+ }
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/chrono/test/duration/comparisons_pass.cpp b/src/boost/libs/chrono/test/duration/comparisons_pass.cpp
new file mode 100644
index 000000000..79deaaa11
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/comparisons_pass.cpp
@@ -0,0 +1,222 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/duration.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#ifdef BOOST_NO_CXX11_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
+
+int main()
+{
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(3);
+ BOOST_TEST(s1 == s2);
+ BOOST_TEST(! (s1 != s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::seconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::seconds s2(3);
+ BOOST_CONSTEXPR_ASSERT(s1 == s2);
+ BOOST_CONSTEXPR_ASSERT(!(s1 != s2));
+ }
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(4);
+ BOOST_TEST(! (s1 == s2));
+ BOOST_TEST(s1 != s2);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::seconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::seconds s2(4);
+ BOOST_CONSTEXPR_ASSERT(! (s1 == s2));
+ BOOST_CONSTEXPR_ASSERT(s1 != s2);
+ }
+ {
+ boost::chrono::milliseconds s1(3);
+ boost::chrono::microseconds s2(3000);
+ BOOST_TEST(s1 == s2);
+ BOOST_TEST(! (s1 != s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::milliseconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::microseconds s2(3000);
+ BOOST_CONSTEXPR_ASSERT(s1 == s2);
+ BOOST_CONSTEXPR_ASSERT(! (s1 != s2));
+ }
+ {
+ boost::chrono::milliseconds s1(3);
+ boost::chrono::microseconds s2(4000);
+ BOOST_TEST(! (s1 == s2));
+ BOOST_TEST(s1 != s2);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::milliseconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::microseconds s2(4000);
+ BOOST_CONSTEXPR_ASSERT(! (s1 == s2));
+ BOOST_CONSTEXPR_ASSERT(s1 != s2);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(10);
+ BOOST_TEST(s1 == s2);
+ BOOST_TEST(! (s1 != s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(10);
+ BOOST_CONSTEXPR_ASSERT(s1 == s2);
+ BOOST_CONSTEXPR_ASSERT(! (s1 != s2));
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(10);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(9);
+ BOOST_TEST(! (s1 == s2));
+ BOOST_TEST(s1 != s2);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(10);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(9);
+ BOOST_CONSTEXPR_ASSERT(! (s1 == s2));
+ BOOST_CONSTEXPR_ASSERT(s1 != s2);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ boost::chrono::duration<double, boost::ratio<3, 5> > s2(10);
+ BOOST_TEST(s1 == s2);
+ BOOST_TEST(! (s1 != s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<3, 5> > s2(10);
+ BOOST_CONSTEXPR_ASSERT(s1 == s2);
+ BOOST_CONSTEXPR_ASSERT(! (s1 != s2));
+ }
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(3);
+ BOOST_TEST(! (s1 < s2));
+ BOOST_TEST(! (s1 > s2));
+ BOOST_TEST( (s1 <= s2));
+ BOOST_TEST( (s1 >= s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::seconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::seconds s2(3);
+ BOOST_CONSTEXPR_ASSERT(! (s1 < s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 > s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 <= s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 >= s2));
+ }
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(4);
+ BOOST_TEST( (s1 < s2));
+ BOOST_TEST(! (s1 > s2));
+ BOOST_TEST( (s1 <= s2));
+ BOOST_TEST(! (s1 >= s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::seconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::seconds s2(4);
+ BOOST_CONSTEXPR_ASSERT( (s1 < s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 > s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 <= s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 >= s2));
+ }
+ {
+ boost::chrono::milliseconds s1(3);
+ boost::chrono::microseconds s2(3000);
+ BOOST_TEST(! (s1 < s2));
+ BOOST_TEST(! (s1 > s2));
+ BOOST_TEST( (s1 <= s2));
+ BOOST_TEST( (s1 >= s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::milliseconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::microseconds s2(3000);
+ BOOST_CONSTEXPR_ASSERT(! (s1 < s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 > s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 <= s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 >= s2));
+ }
+ {
+ boost::chrono::milliseconds s1(3);
+ boost::chrono::microseconds s2(4000);
+ BOOST_TEST( (s1 < s2));
+ BOOST_TEST(! (s1 > s2));
+ BOOST_TEST( (s1 <= s2));
+ BOOST_TEST(! (s1 >= s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::milliseconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::microseconds s2(4000);
+ BOOST_CONSTEXPR_ASSERT( (s1 < s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 > s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 <= s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 >= s2));
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(10);
+ BOOST_TEST(! (s1 < s2));
+ BOOST_TEST(! (s1 > s2));
+ BOOST_TEST( (s1 <= s2));
+ BOOST_TEST( (s1 >= s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(10);
+ BOOST_CONSTEXPR_ASSERT(! (s1 < s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 > s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 <= s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 >= s2));
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(10);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(9);
+ BOOST_TEST(! (s1 < s2));
+ BOOST_TEST( (s1 > s2));
+ BOOST_TEST(! (s1 <= s2));
+ BOOST_TEST( (s1 >= s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(10);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(9);
+ BOOST_CONSTEXPR_ASSERT(! (s1 < s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 > s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 <= s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 >= s2));
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ boost::chrono::duration<double, boost::ratio<3, 5> > s2(10);
+ BOOST_TEST(! (s1 < s2));
+ BOOST_TEST(! (s1 > s2));
+ BOOST_TEST( (s1 <= s2));
+ BOOST_TEST( (s1 >= s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<3, 5> > s2(10);
+ BOOST_CONSTEXPR_ASSERT(! (s1 < s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 > s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 <= s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 >= s2));
+ }
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/chrono/test/duration/cons/convert_float_to_int_fail.cpp b/src/boost/libs/chrono/test/duration/cons/convert_float_to_int_fail.cpp
new file mode 100644
index 000000000..f30240103
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/cons/convert_float_to_int_fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// conversions from floating point to integral durations disallowed
+
+#include <boost/chrono/duration.hpp>
+
+void test()
+{
+ boost::chrono::duration<double> d;
+ boost::chrono::duration<int> i = d;
+}
diff --git a/src/boost/libs/chrono/test/duration/cons/convert_inexact_fail.cpp b/src/boost/libs/chrono/test/duration/cons/convert_inexact_fail.cpp
new file mode 100644
index 000000000..a912daa05
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/cons/convert_inexact_fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// inexact conversions disallowed for integral reps
+
+#include <boost/chrono/duration.hpp>
+
+void test()
+{
+ boost::chrono::microseconds us(1);
+ boost::chrono::milliseconds ms = us;
+}
diff --git a/src/boost/libs/chrono/test/duration/cons/implicit_constructot_fail.cpp b/src/boost/libs/chrono/test/duration/cons/implicit_constructot_fail.cpp
new file mode 100644
index 000000000..72ea507b7
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/cons/implicit_constructot_fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// test for explicit
+
+#include <boost/chrono/duration.hpp>
+
+#include "../../rep.h"
+
+void test()
+{
+ boost::chrono::duration<int> d = 1;
+}
diff --git a/src/boost/libs/chrono/test/duration/cons/non_implicit_convertible_rep_fail.cpp b/src/boost/libs/chrono/test/duration/cons/non_implicit_convertible_rep_fail.cpp
new file mode 100644
index 000000000..0be0a589f
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/cons/non_implicit_convertible_rep_fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Rep2 shall be implicitly convertible to rep
+
+#include <boost/chrono/duration.hpp>
+
+#include "../../rep.h"
+
+void test()
+{
+ boost::chrono::duration<Rep> d(1);
+}
diff --git a/src/boost/libs/chrono/test/duration/cons/treat_as_floating_point_Rep2_true_fail.cpp b/src/boost/libs/chrono/test/duration/cons/treat_as_floating_point_Rep2_true_fail.cpp
new file mode 100644
index 000000000..47c8b2e0c
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/cons/treat_as_floating_point_Rep2_true_fail.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// treat_as_floating_point<Rep2>::value must be false
+
+#include <boost/chrono/duration.hpp>
+
+void test()
+{
+ boost::chrono::duration<int> d(1.);
+}
diff --git a/src/boost/libs/chrono/test/duration/constructor_pass.cpp b/src/boost/libs/chrono/test/duration/constructor_pass.cpp
new file mode 100644
index 000000000..54b76b701
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/constructor_pass.cpp
@@ -0,0 +1,134 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+
+#include <boost/chrono/duration.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+
+#include "../rep.h"
+#include <iostream>
+
+#ifdef BOOST_NO_CXX11_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
+
+template <class D>
+void
+check_default()
+{
+ {
+ D d;
+ BOOST_TEST(d.count() == typename D::rep());
+ }
+}
+template <class D>
+void
+check_constexpr()
+{
+ BOOST_CONSTEXPR D d(0);
+ BOOST_CONSTEXPR_ASSERT(d.count() == typename D::rep());
+}
+
+template <class D, class R>
+void
+check_from_rep(R r)
+{
+ {
+ D d(r);
+ BOOST_TEST(d.count() == r);
+ }
+}
+
+int main()
+{
+ // exact conversions allowed for integral reps
+ {
+ boost::chrono::milliseconds ms(1);
+ boost::chrono::microseconds us = ms;
+ BOOST_TEST(us.count() == 1000);
+ {
+ BOOST_CONSTEXPR boost::chrono::milliseconds ms(1);
+ BOOST_CONSTEXPR boost::chrono::microseconds us = ms;
+ BOOST_CONSTEXPR_ASSERT(us.count() == 1000);
+ }
+ }
+ // inexact conversions allowed for floating point reps
+ {
+ boost::chrono::duration<double, boost::micro> us(1);
+ boost::chrono::duration<double, boost::milli> ms = us;
+ BOOST_TEST(ms.count() == 1./1000);
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::micro> us(1);
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::milli> ms = us;
+ BOOST_CONSTEXPR_ASSERT(ms.count() == 1./1000);
+ }
+ }
+ // Convert int to float
+ {
+ boost::chrono::duration<int> i(3);
+ boost::chrono::duration<double> d = i;
+ BOOST_TEST(d.count() == 3);
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int> i(3);
+ BOOST_CONSTEXPR boost::chrono::duration<double> d = i;
+ BOOST_CONSTEXPR_ASSERT(d.count() == 3);
+ }
+ }
+ // default constructor
+ {
+ check_default<boost::chrono::duration<Rep> >();
+ }
+ {
+ check_constexpr<boost::chrono::duration<int> >();
+ }
+ // constructor from rep
+ {
+ check_from_rep<boost::chrono::duration<int> >(5);
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int> d(5);
+ BOOST_CONSTEXPR_ASSERT(d.count() == 5);
+ }
+ check_from_rep<boost::chrono::duration<int, boost::ratio<3, 2> > >(5);
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 2> > d(5);
+ BOOST_CONSTEXPR_ASSERT(d.count() == 5);
+ }
+ check_from_rep<boost::chrono::duration<Rep, boost::ratio<3, 2> > >(Rep(3));
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<Rep, boost::ratio<3, 2> > d(Rep(3));
+ BOOST_CONSTEXPR_ASSERT(d.count() == Rep(3));
+ }
+ check_from_rep<boost::chrono::duration<double, boost::ratio<2, 3> > >(5.5);
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<3, 2> > d(5.5);
+ BOOST_CONSTEXPR_ASSERT(d.count() == 5.5);
+ }
+
+
+ }
+ // constructor from other rep
+ {
+ boost::chrono::duration<double> d(5);
+ BOOST_TEST(d.count() == 5);
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<double> d(5);
+ BOOST_CONSTEXPR_ASSERT(d.count() == 5);
+ }
+ }
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/chrono/test/duration/default_ratio_pass.cpp b/src/boost/libs/chrono/test/duration/default_ratio_pass.cpp
new file mode 100644
index 000000000..1d8ad3a24
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/default_ratio_pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// duration
+// Test default template arg:
+
+// template <class Rep, class Period = ratio<1>>
+// class duration;
+
+#include <boost/chrono/duration.hpp>
+#include <boost/type_traits.hpp>
+#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+BOOST_CHRONO_STATIC_ASSERT((boost::is_same<
+ boost::chrono::duration<int, boost::ratio<1> >,
+ boost::chrono::duration<int>
+>::value), NOTHING, ());
diff --git a/src/boost/libs/chrono/test/duration/duration_cast_int_fail.cpp b/src/boost/libs/chrono/test/duration/duration_cast_int_fail.cpp
new file mode 100644
index 000000000..77b03b74c
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/duration_cast_int_fail.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// ToDuration must be an instantiation of duration.
+
+#include <boost/chrono/duration.hpp>
+
+void test()
+{
+ boost::chrono::duration_cast<int>(boost::chrono::milliseconds(3));
+}
diff --git a/src/boost/libs/chrono/test/duration/duration_cast_pass.cpp b/src/boost/libs/chrono/test/duration/duration_cast_pass.cpp
new file mode 100644
index 000000000..0364faa36
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/duration_cast_pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/duration.hpp>
+#include <boost/type_traits.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+#ifdef BOOST_NO_CXX11_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
+
+
+template <class ToDuration, class FromDuration>
+void
+test(const FromDuration& f, const ToDuration& d)
+{
+//~ #if defined(BOOST_NO_CXX11_DECLTYPE)
+ //~ typedef BOOST_TYPEOF_TPL(boost::chrono::duration_cast<ToDuration>(f)) R;
+//~ #else
+ //~ typedef decltype(boost::chrono::duration_cast<ToDuration>(f)) R;
+//~ #endif
+ //~ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<R, ToDuration>::value), NOTHING, (R, ToDuration));
+ BOOST_TEST(boost::chrono::duration_cast<ToDuration>(f) == d);
+}
+
+int main()
+{
+ test(boost::chrono::milliseconds(7265000), boost::chrono::hours(2));
+ test(boost::chrono::milliseconds(7265000), boost::chrono::minutes(121));
+ test(boost::chrono::milliseconds(7265000), boost::chrono::seconds(7265));
+ test(boost::chrono::milliseconds(7265000), boost::chrono::milliseconds(7265000));
+ test(boost::chrono::milliseconds(7265000), boost::chrono::microseconds(7265000000LL));
+ test(boost::chrono::milliseconds(7265000), boost::chrono::nanoseconds(7265000000000LL));
+ test(boost::chrono::milliseconds(7265000),
+ boost::chrono::duration<double, boost::ratio<3600> >(7265./3600));
+ test(boost::chrono::duration<int, boost::ratio<2, 3> >(9),
+ boost::chrono::duration<int, boost::ratio<3, 5> >(10));
+ {
+ BOOST_CONSTEXPR boost::chrono::hours h = boost::chrono::duration_cast<boost::chrono::hours>(boost::chrono::milliseconds(7265000));
+ BOOST_CONSTEXPR_ASSERT(h.count() == 2);
+ }
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/chrono/test/duration/duration_duration_fail.cpp b/src/boost/libs/chrono/test/duration/duration_duration_fail.cpp
new file mode 100644
index 000000000..19e6928ee
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/duration_duration_fail.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// duration
+// If a program instantiates duration with a duration type for the template
+// argument Rep a diagnostic is required.
+
+#include <boost/chrono/duration.hpp>
+
+void test()
+{
+ typedef boost::chrono::duration<boost::chrono::milliseconds> D;
+ D d;
+}
diff --git a/src/boost/libs/chrono/test/duration/duration_values_pass.cpp b/src/boost/libs/chrono/test/duration/duration_values_pass.cpp
new file mode 100644
index 000000000..9d6b84b17
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/duration_values_pass.cpp
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/duration.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#include "../rep.h"
+#if defined BOOST_NO_CXX11_NUMERIC_LIMITS || defined BOOST_NO_CXX11_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
+
+template <class D>
+void check_max()
+{
+ typedef typename D::rep Rep;
+ Rep max_rep = (boost::chrono::duration_values<Rep>::max)();
+ BOOST_TEST((D::max)().count() == max_rep);
+ {
+ typedef typename D::rep Rep;
+ BOOST_CHRONO_LIB_CONSTEXPR Rep max_rep = (boost::chrono::duration_values<Rep>::max)();
+ BOOST_CONSTEXPR_ASSERT((D::max)().count() == max_rep);
+ }
+}
+
+template <class D>
+void check_min()
+{
+ typedef typename D::rep Rep;
+ Rep min_rep = (boost::chrono::duration_values<Rep>::min)();
+ BOOST_TEST((D::min)().count() == min_rep);
+ {
+ typedef typename D::rep Rep;
+ BOOST_CHRONO_LIB_CONSTEXPR Rep min_rep = (boost::chrono::duration_values<Rep>::min)();
+ BOOST_CONSTEXPR_ASSERT((D::min)().count() == min_rep);
+
+ }
+}
+
+template <class D>
+void check_zero()
+{
+ typedef typename D::rep Rep;
+ Rep zero_rep = boost::chrono::duration_values<Rep>::zero();
+ BOOST_TEST(D::zero().count() == zero_rep);
+ {
+ typedef typename D::rep Rep;
+ BOOST_CONSTEXPR Rep zero_rep = boost::chrono::duration_values<Rep>::zero();
+ BOOST_CONSTEXPR_ASSERT(D::zero().count() == zero_rep);
+
+ }
+}
+
+
+int main()
+{
+ check_max<boost::chrono::duration<int> >();
+ check_max<boost::chrono::duration<Rep> >();
+ check_min<boost::chrono::duration<int> >();
+ check_min<boost::chrono::duration<Rep> >();
+ check_zero<boost::chrono::duration<int> >();
+ check_zero<boost::chrono::duration<Rep> >();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/chrono/test/duration/nonmember/divide_rep2_fail.cpp b/src/boost/libs/chrono/test/duration/nonmember/divide_rep2_fail.cpp
new file mode 100644
index 000000000..649f17ea2
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/nonmember/divide_rep2_fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/duration.hpp>
+
+#include "../../rep.h"
+
+void test()
+{
+ boost::chrono::duration<Rep> d(Rep(15));
+ d = d / 5;
+}
diff --git a/src/boost/libs/chrono/test/duration/nonmember/modulus_rep2_fail.cpp b/src/boost/libs/chrono/test/duration/nonmember/modulus_rep2_fail.cpp
new file mode 100644
index 000000000..b5b8c7e4a
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/nonmember/modulus_rep2_fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/duration.hpp>
+
+#include "../../rep.h"
+
+void test()
+{
+ boost::chrono::duration<Rep> d(Rep(15));
+ d = d % 5;
+}
diff --git a/src/boost/libs/chrono/test/duration/nonmember/times_rep2_lhs_fail.cpp b/src/boost/libs/chrono/test/duration/nonmember/times_rep2_lhs_fail.cpp
new file mode 100644
index 000000000..84c6a405d
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/nonmember/times_rep2_lhs_fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/duration.hpp>
+
+#include "../../rep.h"
+
+void test()
+{
+ boost::chrono::duration<Rep> d;
+ d = 5 * d;
+}
diff --git a/src/boost/libs/chrono/test/duration/nonmember/times_rep2_rhs_fail.cpp b/src/boost/libs/chrono/test/duration/nonmember/times_rep2_rhs_fail.cpp
new file mode 100644
index 000000000..0172b9994
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/nonmember/times_rep2_rhs_fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/duration.hpp>
+
+#include "../../rep.h"
+
+void test()
+{
+ boost::chrono::duration<Rep> d;
+ d = d * 5;
+}
diff --git a/src/boost/libs/chrono/test/duration/positive_num_fail.cpp b/src/boost/libs/chrono/test/duration/positive_num_fail.cpp
new file mode 100644
index 000000000..fbd25f67b
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/positive_num_fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// duration
+// Period::num must be positive, diagnostic required.
+
+#include <boost/chrono/duration.hpp>
+
+void test()
+{
+ typedef boost::chrono::duration<int, boost::ratio<5, -1> > D;
+ D d;
+}
diff --git a/src/boost/libs/chrono/test/duration/ratio_alias_pass.cpp b/src/boost/libs/chrono/test/duration/ratio_alias_pass.cpp
new file mode 100644
index 000000000..a949032ad
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/ratio_alias_pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// duration
+// Period shall be a specialization of ratio, diagnostic required.
+
+#include <boost/chrono/duration.hpp>
+
+void test()
+{
+ typedef boost::chrono::duration<int,
+ boost::ratio_add<
+ boost::ratio<1,2>,
+ boost::ratio<1,3>
+ >
+ > D;
+ D d;
+ (void)d;
+}
diff --git a/src/boost/libs/chrono/test/duration/ratio_fail.cpp b/src/boost/libs/chrono/test/duration/ratio_fail.cpp
new file mode 100644
index 000000000..5ea4b60b7
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/ratio_fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// duration
+// Period shall be a specialization of ratio, diagnostic required.
+
+#include <boost/chrono/duration.hpp>
+
+void test()
+{
+ typedef boost::chrono::duration<int, int > D;
+ D d;
+}
diff --git a/src/boost/libs/chrono/test/duration/rounding_pass.cpp b/src/boost/libs/chrono/test/duration/rounding_pass.cpp
new file mode 100644
index 000000000..06a32a1b8
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/rounding_pass.cpp
@@ -0,0 +1,105 @@
+// Copyright 2013 Krzysztof Czainski
+// Copyright 2013 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+/*
+ * @file chrono_rounding.cpp
+ *
+ * @since 2013-11-22
+ * @author Krzysztof Czainski <1czajnik@gmail.com>
+ */
+
+#include <boost/cstdint.hpp>
+#include <boost/chrono/ceil.hpp>
+#include <boost/chrono/floor.hpp>
+#include <boost/chrono/round.hpp>
+
+#include <boost/chrono/chrono_io.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+using namespace boost::chrono;
+
+void test_floor()
+{
+ BOOST_TEST_EQ( seconds(-2), floor<seconds>( milliseconds(-2000) ) );
+ BOOST_TEST_EQ( seconds(-2), floor<seconds>( milliseconds(-1999) ) );
+ BOOST_TEST_EQ( seconds(-2), floor<seconds>( milliseconds(-1001) ) );
+ BOOST_TEST_EQ( seconds(-1), floor<seconds>( milliseconds(-1000) ) );
+ BOOST_TEST_EQ( seconds(-1), floor<seconds>( milliseconds(-999) ) );
+ BOOST_TEST_EQ( seconds(-1), floor<seconds>( milliseconds(-1) ) );
+ BOOST_TEST_EQ( seconds(0), floor<seconds>( milliseconds(0) ) );
+ BOOST_TEST_EQ( seconds(0), floor<seconds>( milliseconds(1) ) );
+ BOOST_TEST_EQ( seconds(0), floor<seconds>( milliseconds(999) ) );
+ BOOST_TEST_EQ( seconds(1), floor<seconds>( milliseconds(1000) ) );
+ BOOST_TEST_EQ( seconds(1), floor<seconds>( milliseconds(1001) ) );
+ BOOST_TEST_EQ( seconds(1), floor<seconds>( milliseconds(1999) ) );
+ BOOST_TEST_EQ( seconds(2), floor<seconds>( milliseconds(2000) ) );
+
+ {
+ // check that int32 isn't overflowed in intermediate calculations:
+ typedef duration<boost::int32_t> sec32;
+ typedef duration< boost::int32_t, boost::ratio<999,1000> > sec32_m1ms;
+ BOOST_TEST_EQ( sec32(-999000000), floor<sec32>( sec32_m1ms(-1000000000) ) );
+ BOOST_TEST_EQ( sec32( 999000000), floor<sec32>( sec32_m1ms( 1000000000) ) );
+ }
+}
+
+void test_ceil()
+{
+ BOOST_TEST_EQ( seconds(-2), ceil<seconds>( milliseconds(-2000) ) );
+ BOOST_TEST_EQ( seconds(-1), ceil<seconds>( milliseconds(-1999) ) );
+ BOOST_TEST_EQ( seconds(-1), ceil<seconds>( milliseconds(-1001) ) );
+ BOOST_TEST_EQ( seconds(-1), ceil<seconds>( milliseconds(-1000) ) );
+ BOOST_TEST_EQ( seconds(0), ceil<seconds>( milliseconds(-999) ) );
+ BOOST_TEST_EQ( seconds(0), ceil<seconds>( milliseconds(-1) ) );
+ BOOST_TEST_EQ( seconds(0), ceil<seconds>( milliseconds(0) ) );
+ BOOST_TEST_EQ( seconds(1), ceil<seconds>( milliseconds(1) ) );
+ BOOST_TEST_EQ( seconds(1), ceil<seconds>( milliseconds(999) ) );
+ BOOST_TEST_EQ( seconds(1), ceil<seconds>( milliseconds(1000) ) );
+ BOOST_TEST_EQ( seconds(2), ceil<seconds>( milliseconds(1001) ) );
+ BOOST_TEST_EQ( seconds(2), ceil<seconds>( milliseconds(1999) ) );
+ BOOST_TEST_EQ( seconds(2), ceil<seconds>( milliseconds(2000) ) );
+ {
+ // check that int32 isn't overflowed in intermediate calculations:
+ typedef duration<boost::int32_t> sec32;
+ typedef duration< boost::int32_t, boost::ratio<999,1000> > sec32_m1ms;
+ BOOST_TEST_EQ( sec32(-999000000), ceil<sec32>( sec32_m1ms(-1000000000) ) );
+ BOOST_TEST_EQ( sec32( 999000000), ceil<sec32>( sec32_m1ms( 1000000000) ) );
+ }
+}
+
+void test_round()
+{
+ // to even on tie
+ BOOST_TEST_EQ( seconds(-2), round<seconds>( milliseconds(-2000) ) );
+ BOOST_TEST_EQ( seconds(-2), round<seconds>( milliseconds(-1500) ) );
+ BOOST_TEST_EQ( seconds(-1), round<seconds>( milliseconds(-1499) ) );
+ BOOST_TEST_EQ( seconds(-1), round<seconds>( milliseconds(-1000) ) );
+ BOOST_TEST_EQ( seconds(0), round<seconds>( milliseconds(-500) ) );
+ BOOST_TEST_EQ( seconds(0), round<seconds>( milliseconds(-499) ) );
+ BOOST_TEST_EQ( seconds(0), round<seconds>( milliseconds(0) ) );
+ BOOST_TEST_EQ( seconds(0), round<seconds>( milliseconds(499) ) );
+ BOOST_TEST_EQ( seconds(0), round<seconds>( milliseconds(500) ) );
+ BOOST_TEST_EQ( seconds(1), round<seconds>( milliseconds(1000) ) );
+ BOOST_TEST_EQ( seconds(1), round<seconds>( milliseconds(1499) ) );
+ BOOST_TEST_EQ( seconds(2), round<seconds>( milliseconds(1500) ) );
+ BOOST_TEST_EQ( seconds(2), round<seconds>( milliseconds(2000) ) );
+ {
+ // check that int32 isn't overflowed in intermediate calculations:
+ typedef duration<boost::int32_t> sec32;
+ typedef duration< boost::int32_t, boost::ratio<999,1000> > sec32_m1ms;
+ BOOST_TEST_EQ( sec32(-999000000), round<sec32>( sec32_m1ms(-1000000000) ) );
+ BOOST_TEST_EQ( sec32( 999000000), round<sec32>( sec32_m1ms( 1000000000) ) );
+ }
+}
+
+int main()
+{
+ test_floor();
+ test_ceil();
+ test_round();
+ return boost::report_errors();
+
+}
diff --git a/src/boost/libs/chrono/test/duration/typedefs_pass.cpp b/src/boost/libs/chrono/test/duration/typedefs_pass.cpp
new file mode 100644
index 000000000..2f9d2ef32
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/typedefs_pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+
+#include <boost/chrono/duration.hpp>
+#include <boost/type_traits.hpp>
+#include <limits>
+
+#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+template <typename D, int ExpectedDigits, typename ExpectedPeriod>
+void check_duration()
+{
+ typedef typename D::rep Rep;
+ typedef typename D::period Period;
+ BOOST_CHRONO_STATIC_ASSERT(boost::is_signed<Rep>::value, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT(boost::is_integral<Rep>::value, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT(std::numeric_limits<Rep>::digits >= ExpectedDigits, NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<Period, ExpectedPeriod >::value), NOTHING, ());
+}
+
+void test()
+{
+ check_duration<boost::chrono::hours, 22, boost::ratio<3600> >();
+ check_duration<boost::chrono::minutes, 28, boost::ratio<60> >();
+ check_duration<boost::chrono::seconds, 34, boost::ratio<1> >();
+ check_duration<boost::chrono::milliseconds, 44, boost::milli >();
+ check_duration<boost::chrono::microseconds, 54, boost::micro >();
+ check_duration<boost::chrono::nanoseconds, 63, boost::nano >();
+}
diff --git a/src/boost/libs/chrono/test/duration/types_pass.cpp b/src/boost/libs/chrono/test/duration/types_pass.cpp
new file mode 100644
index 000000000..568ce0e29
--- /dev/null
+++ b/src/boost/libs/chrono/test/duration/types_pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// duration
+// Test nested types
+
+// typedef Rep rep;
+// typedef Period period;
+
+#include <boost/chrono/duration.hpp>
+#include <boost/type_traits.hpp>
+#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+typedef boost::chrono::duration<long, boost::ratio<3, 2> > D;
+BOOST_CHRONO_STATIC_ASSERT((boost::is_same<D::rep, long>::value), NOTHING, ());
+BOOST_CHRONO_STATIC_ASSERT((boost::is_same<D::period, boost::ratio<3, 2> >::value), NOTHING, ());
diff --git a/src/boost/libs/chrono/test/intmax_c.cpp b/src/boost/libs/chrono/test/intmax_c.cpp
new file mode 100644
index 000000000..e3dab7aca
--- /dev/null
+++ b/src/boost/libs/chrono/test/intmax_c.cpp
@@ -0,0 +1,19 @@
+// intmax_c.cpp --------------------------------------------------------------//
+
+// Copyright 2010 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/cstdint.hpp>
+
+#ifdef INTMAX_C
+#define BOOST_INTMAX_C(a) INTMAX_C(a)
+#else
+#define BOOST_INTMAX_C(a) a##LL
+#endif
+
+boost::intmax_t i = BOOST_INTMAX_C(1000000000);
+int main() {
+ return (i);
+}
diff --git a/src/boost/libs/chrono/test/io/duration_input.cpp b/src/boost/libs/chrono/test/io/duration_input.cpp
new file mode 100644
index 000000000..1ad8efc51
--- /dev/null
+++ b/src/boost/libs/chrono/test/io/duration_input.cpp
@@ -0,0 +1,124 @@
+// Distributed under the Boost Software License, Version 1.0.
+// Copyright 2011 Vicente J. Botet Escriba
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/chrono_io.hpp>
+//#include <boost/chrono/io/duration_units.hpp>
+#include <sstream>
+#include <boost/detail/lightweight_test.hpp>
+
+
+template<typename D>
+void test_good(const char* str, D res)
+{
+ std::istringstream in(str);
+ D d(0);
+ in >> d;
+ BOOST_TEST(in.eof());
+ BOOST_TEST(!in.fail());
+ BOOST_TEST(d == res);
+ std::cout << str << " " << res << " " << d << std::endl;
+}
+
+template<typename DFail>
+void test_fail(const char* str, DFail res)
+{
+ {
+ std::istringstream in(str);
+ DFail d = DFail::zero();
+ in >> d;
+ BOOST_TEST(in.fail());
+ BOOST_TEST(d == DFail::zero());
+ std::cout << str << " " << res << " " << d << std::endl;
+ }
+}
+
+template<typename D>
+void test_not_eof(const char* str, D res)
+{
+ {
+ std::istringstream in(str);
+ D d = D::zero();
+ in >> d;
+ BOOST_TEST(!in.eof());
+ BOOST_TEST(d == res);
+ std::cout << str << " " << res << " " << d << std::endl;
+ }
+}
+int main()
+{
+ using namespace boost::chrono;
+ using namespace boost;
+
+ test_good("5000", 5000);
+
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ test_good("5000 hours", hours(5000));
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ test_good("5000 minutes", minutes(5000));
+ test_good("5000 seconds", seconds(5000));
+ test_fail("1.0 second", seconds(1));
+
+ test_good("1.0 second", duration<float,ratio<1> >(1));
+ /* BUG with DURATION_GET
+../../../boost/math/common_factor_rt.hpp: In function 'RingType boost::math::detail::gcd_euclidean(RingType, RingType) [with RingType = long double]':
+../../../boost/math/common_factor_rt.hpp:122: instantiated from 'IntegerType boost::math::detail::gcd_integer(const IntegerType&, const IntegerType&) [with IntegerType = long double]'
+../../../boost/math/common_factor_rt.hpp:240: instantiated from 'T boost::math::detail::gcd_optimal_evaluator_helper_t<T, true, true>::operator()(const T&, const T&) [with T = long double]'
+../../../boost/math/common_factor_rt.hpp:290: instantiated from 'T boost::math::detail::gcd_optimal_evaluator<T>::operator()(const T&, const T&) [with T = long double]'
+../../../boost/math/common_factor_rt.hpp:442: instantiated from 'T boost::math::detail::gcd_optimal(const T&, const T&) [with T = long double]'
+../../../boost/math/common_factor_rt.hpp:473: instantiated from 'typename boost::math::gcd_evaluator<IntegerType>::result_type boost::math::gcd_evaluator<IntegerType>::operator()(const IntegerType&, const IntegerType&) const [with IntegerType = long double]'
+../../../boost/math/common_factor_rt.hpp:505: instantiated from 'IntegerType boost::math::gcd(const IntegerType&, const IntegerType&) [with IntegerType = long double]'
+../../../boost/chrono/io/duration_get.hpp:239: instantiated from 'InputIterator boost::chrono::duration_get<CharT, InputIterator>::get(InputIterator, InputIterator, std::ios_base&, std::_Ios_Iostate&, boost::chrono::duration<Rep2, Period2>&, const CharT*, const CharT*) const [with Rep = double, Period = boost::ratio<1l, 1l>, CharT = char, InputIterator = std::istreambuf_iterator<char, std::char_traits<char> >]'
+../../../boost/chrono/io/duration_get.hpp:294: instantiated from 'InputIterator boost::chrono::duration_get<CharT, InputIterator>::get(InputIterator, InputIterator, std::ios_base&, std::_Ios_Iostate&, boost::chrono::duration<Rep2, Period2>&) const [with Rep = double, Period = boost::ratio<1l, 1l>, CharT = char, InputIterator = std::istreambuf_iterator<char, std::char_traits<char> >]'
+../../../boost/chrono/io/duration_io.hpp:593: instantiated from 'std::basic_istream<_CharT, _Traits>& boost::chrono::operator>>(std::basic_istream<_CharT, _Traits>&, boost::chrono::duration<Rep2, Period2>&) [with CharT = char, Traits = std::char_traits<char>, Rep = double, Period = boost::ratio<1l, 1l>]'
+io/duration_input.cpp:15: instantiated from 'void test_good(const char*, D) [with D = boost::chrono::duration<double, boost::ratio<1l, 1l> >]'
+io/duration_input.cpp:52: instantiated from here
+../../../boost/math/common_factor_rt.hpp:102: error: invalid operands of types 'long double' and 'long double' to binary 'operator%'
+../../../boost/math/common_factor_rt.hpp:102: error: in evaluation of 'operator%=(long double, long double)'
+../../../boost/math/common_factor_rt.hpp:106: error: invalid operands of types 'long double' and 'long double' to binary 'operator%'
+../../../boost/math/common_factor_rt.hpp:106: error: in evaluation of 'operator%=(long double, long double)'
+ *
+ */
+ test_good("1 second", seconds(1));
+ test_not_eof("1 second ", seconds(1));
+ test_not_eof("1 seconde", seconds(1));
+ test_good("1 seconds", seconds(1));
+ test_good("0 seconds", seconds(0));
+ test_good("-1 seconds", seconds(-1));
+ test_good("5000 milliseconds", milliseconds(5000));
+ test_good("5000 microseconds", microseconds(5000));
+ test_good("5000 nanoseconds", nanoseconds(5000));
+ test_good("5000 deciseconds", duration<boost::int_least64_t, deci> (5000));
+ test_good("5000 [1/30]seconds", duration<boost::int_least64_t, ratio<1, 30> > (5000));
+ test_good("5000 [1/30]second", duration<boost::int_least64_t, ratio<1, 30> > (5000));
+ test_good("5000 h", hours(5000));
+#if BOOST_CHRONO_VERSION==2
+ test_good("5000 min", minutes(5000));
+#else
+ test_good("5000 m", minutes(5000));
+#endif
+ test_good("5000 s", seconds(5000));
+ test_good("5000 ms", milliseconds(5000));
+ test_good("5000 ns", nanoseconds(5000));
+ test_good("5000 ds", duration<boost::int_least64_t, deci> (5000));
+ test_good("5000 [1/30]s", duration<boost::int_least64_t, ratio<1, 30> > (5000));
+ test_not_eof("5000 [1/30]ss", duration<boost::int_least64_t, ratio<1, 30> > (5000));
+ std::cout << __LINE__<< "*****" << std::endl;
+ test_good("5000 milliseconds", seconds(5));
+ test_good("5000 millisecond", seconds(5));
+ test_good("5 milliseconds", nanoseconds(5000000));
+ std::cout << __LINE__<< "*****" << std::endl;
+ test_good("4000 ms", seconds(4));
+ std::cout << __LINE__<< "*****" << std::endl;
+ test_fail("3001 ms", seconds(3));
+ std::cout << __LINE__<< "*****" << std::endl;
+ test_fail("3001 ", milliseconds(3001));
+ std::cout << __LINE__<< "*****" << std::endl;
+ test_fail("one ms", milliseconds(1));
+ test_fail("5000 millisecon", seconds(5));
+ test_not_eof("3001 ms ", milliseconds(3001));
+
+ return boost::report_errors();
+
+}
+
diff --git a/src/boost/libs/chrono/test/io/duration_output.cpp b/src/boost/libs/chrono/test/io/duration_output.cpp
new file mode 100644
index 000000000..e81131532
--- /dev/null
+++ b/src/boost/libs/chrono/test/io/duration_output.cpp
@@ -0,0 +1,114 @@
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/chrono_io.hpp>
+#include <sstream>
+#include <boost/detail/lightweight_test.hpp>
+
+template<typename D>
+void test_good_prefix(const char* str, D d)
+{
+ std::ostringstream out;
+ out << d;
+ BOOST_TEST(out.good());
+
+ BOOST_TEST(out.str() == str);
+}
+
+template<typename D>
+void test_good_symbol(const char* str, D d)
+{
+ std::ostringstream out;
+#if BOOST_CHRONO_VERSION==2
+ out << boost::chrono::duration_fmt(boost::chrono::duration_style::symbol) << d;
+#else
+ out << boost::chrono::duration_short << d;
+#endif
+ BOOST_TEST(out.good());
+ BOOST_TEST_EQ(out.str(), str);
+}
+#if BOOST_CHRONO_VERSION==2
+
+template<typename D>
+void test_good(const char* str, D d, boost::chrono::duration_style style)
+{
+ std::ostringstream out;
+
+ out << boost::chrono::duration_fmt(style) << d;
+ BOOST_TEST(out.good());
+ BOOST_TEST(out.str() == str);
+}
+
+template<typename D>
+void test_state_saver(const char* str, const char* str2, D d, boost::chrono::duration_style style)
+{
+ std::ostringstream out;
+ {
+ boost::chrono::duration_style_io_saver ios(out);
+ out << boost::chrono::duration_fmt(style) << d;
+ BOOST_TEST(out.good());
+ BOOST_TEST(out.str() == str);
+ }
+ out << " " << d;
+ BOOST_TEST(out.good());
+ BOOST_TEST(out.str() == str2);
+}
+
+template<typename D>
+void test_state_saver2(const char* str, const char* str2, D d, boost::chrono::duration_style style)
+{
+ std::ostringstream out;
+ {
+ boost::chrono::duration_style_io_saver ios(out, style);
+ out << d;
+ BOOST_TEST(out.good());
+ BOOST_TEST(out.str() == str);
+ }
+ out << " " << d;
+ BOOST_TEST(out.good());
+ BOOST_TEST(out.str() == str2);
+}
+
+#endif
+
+int main()
+{
+ using namespace boost::chrono;
+ using namespace boost;
+
+ test_good_prefix("5000 hours", hours(5000));
+ test_good_prefix("5000 minutes", minutes(5000));
+ test_good_prefix("5000 seconds", seconds(5000));
+ test_good_prefix("0 seconds", seconds(0));
+ test_good_prefix("1 second", seconds(1));
+ test_good_prefix("-1 second", seconds(-1));
+ test_good_prefix("5000 milliseconds", milliseconds(5000));
+ test_good_prefix("5000 microseconds", microseconds(5000));
+ test_good_prefix("5000 nanoseconds", nanoseconds(5000));
+ test_good_prefix("5000 deciseconds", duration<boost::int_least64_t, deci> (5000));
+ test_good_prefix("5000 [1/30]seconds", duration<boost::int_least64_t, ratio<1, 30> > (5000));
+
+ test_good_symbol("5000 h", hours(5000));
+#if BOOST_CHRONO_VERSION==2
+ test_good_symbol("5000 min", minutes(5000));
+#else
+ test_good_symbol("5000 m", minutes(5000));
+#endif
+ test_good_symbol("5000 s", seconds(5000));
+ test_good_symbol("5000 ms", milliseconds(5000));
+ test_good_symbol("5000 ns", nanoseconds(5000));
+ test_good_symbol("5000 ds", duration<boost::int_least64_t, deci> (5000));
+ test_good_symbol("5000 [1/30]s", duration<boost::int_least64_t, ratio<1, 30> > (5000));
+
+#if BOOST_CHRONO_VERSION==2
+ test_good("5000 hours", hours(5000), duration_style::prefix);
+ test_good("5000 h", hours(5000), duration_style::symbol);
+ test_state_saver("5000 h", "5000 h 5000 hours", hours(5000), duration_style::symbol);
+ test_state_saver2("5000 h", "5000 h 5000 hours", hours(5000), duration_style::symbol);
+#endif
+
+ return boost::report_errors();
+
+}
+
diff --git a/src/boost/libs/chrono/test/io/time_point_input.cpp b/src/boost/libs/chrono/test/io/time_point_input.cpp
new file mode 100644
index 000000000..7f0e9348c
--- /dev/null
+++ b/src/boost/libs/chrono/test/io/time_point_input.cpp
@@ -0,0 +1,238 @@
+// Copyright 2011 Vicente J. Botet Escriba
+// Copyright (c) Microsoft Corporation 2014
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/chrono_io.hpp>
+#include <sstream>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/chrono/system_clocks.hpp>
+#include <boost/chrono/thread_clock.hpp>
+#include <boost/chrono/process_cpu_clocks.hpp>
+#if 0
+template <typename Clock, typename D>
+void test_good(std::string str, D res)
+{
+ typedef typename Clock::time_point clock_time_point;
+ typedef typename Clock::duration clock_duration;
+ std::istringstream in(str + boost::chrono::clock_string<Clock, char>::since());
+ clock_time_point tp;
+ in >> tp;
+ BOOST_TEST(in.eof());
+ BOOST_TEST(!in.fail());
+ std::cout << "Input= " << str << std::endl;
+ std::cout << "Expected= " << clock_time_point(boost::chrono::duration_cast<clock_duration>(res)) << std::endl;
+ std::cout << "Obtained= " << tp << std::endl;
+ BOOST_TEST( (tp == clock_time_point(boost::chrono::duration_cast<clock_duration>(res)) ));
+}
+
+#else
+template <typename Clock, typename D>
+void test_good(std::string str, D res)
+{
+ typedef boost::chrono::time_point<Clock, D> clock_time_point;
+ //typedef typename Clock::duration clock_duration;
+ std::istringstream in(str + boost::chrono::clock_string<Clock, char>::since());
+ clock_time_point tp;
+ in >> tp;
+ BOOST_TEST(in.eof());
+ BOOST_TEST(!in.fail());
+ std::cout << "Input= " << str << std::endl;
+ std::cout << "Expected= " << clock_time_point(res) << std::endl;
+ std::cout << "Obtained= " << tp << std::endl;
+ BOOST_TEST( tp == clock_time_point(res) );
+}
+
+#endif
+#if BOOST_CHRONO_VERSION >= 2
+template <typename D>
+void test_good_system_clock(std::string str, D res)
+{
+ typedef boost::chrono::system_clock Clock;
+
+ std::istringstream in(str);
+ boost::chrono::time_point<Clock, D> tp;
+ in >> tp;
+ BOOST_TEST(in.eof());
+ BOOST_TEST(!in.fail());
+ std::cout << "Input= " << str << std::endl;
+ std::cout << "Expected= " << boost::chrono::time_point<Clock, D>(res) << std::endl;
+ std::cout << "Obtained= " << tp << std::endl;
+ std::cout << "Expected= " << boost::chrono::duration_cast<boost::chrono::nanoseconds>(boost::chrono::time_point<Clock, D>(res).time_since_epoch()).count() << std::endl;
+ std::cout << "Obtained= " << boost::chrono::duration_cast<boost::chrono::nanoseconds>(tp.time_since_epoch()).count() << std::endl;
+ BOOST_TEST( (tp == boost::chrono::time_point<Clock, D>(res)));
+}
+
+template <typename D>
+void test_good_utc_fmt_system_clock(std::string str, std::string fmt, D res)
+{
+ typedef boost::chrono::system_clock Clock;
+
+ std::istringstream in(str);
+ boost::chrono::time_point<Clock, D> tp;
+ in >> time_fmt(boost::chrono::timezone::utc, fmt);
+ in >> tp;
+ BOOST_TEST(in.eof());
+ BOOST_TEST(!in.fail());
+ std::cout << "Input= " << str << std::endl;
+ std::cout << "Expected= " << boost::chrono::time_point<Clock, D>(res) << std::endl;
+ std::cout << "Obtained= " << tp << std::endl;
+ std::cout << "Expected= " << boost::chrono::duration_cast<boost::chrono::nanoseconds>(boost::chrono::time_point<Clock, D>(res).time_since_epoch()).count() << std::endl;
+ std::cout << "Obtained= " << boost::chrono::duration_cast<boost::chrono::nanoseconds>(tp.time_since_epoch()).count() << std::endl;
+ BOOST_TEST_EQ( tp , (boost::chrono::time_point<Clock, D>(res)));
+}
+#endif
+template <typename Clock, typename D>
+void test_fail(const char* str, D)
+{
+ std::istringstream in(str + boost::chrono::clock_string<Clock, char>::since());
+ boost::chrono::time_point<Clock, D> tp;
+ in >> tp;
+ BOOST_TEST(in.fail());
+ BOOST_TEST( (tp == boost::chrono::time_point<Clock, D>()));
+}
+
+template <typename Clock, typename D>
+void test_fail_no_epoch(const char* str, D )
+{
+ std::istringstream in(str);
+ boost::chrono::time_point<Clock, D> tp;
+ in >> tp;
+ BOOST_TEST(in.fail());
+ BOOST_TEST( (tp == boost::chrono::time_point<Clock, D>()));
+}
+
+template <typename Clock, typename D>
+void test_fail_epoch(const char* str, D)
+{
+ std::istringstream in(str);
+ boost::chrono::time_point<Clock, D> tp;
+ in >> tp;
+ BOOST_TEST(in.fail());
+ BOOST_TEST( (tp == boost::chrono::time_point<Clock, D>()));
+}
+
+template <typename Clock>
+void check_all()
+{
+ using namespace boost::chrono;
+ using namespace boost;
+
+ test_good<Clock> ("5000 hours", hours(5000));
+ test_good<Clock> ("5000 minutes", minutes(5000));
+ test_good<Clock> ("5000 seconds", seconds(5000));
+ test_good<Clock> ("1 seconds", seconds(1));
+ test_good<Clock> ("1 second", seconds(1));
+ test_good<Clock> ("-1 seconds", seconds(-1));
+ test_good<Clock> ("0 second", seconds(0));
+ test_good<Clock> ("0 seconds", seconds(0));
+ test_good<Clock> ("5000 milliseconds", milliseconds(5000));
+ test_good<Clock> ("5000 microseconds", microseconds(5000));
+ test_good<Clock> ("5000 nanoseconds", nanoseconds(5000));
+ test_good<Clock> ("5000 deciseconds", duration<boost::int_least64_t, deci> (5000));
+ test_good<Clock> ("5000 [1/30]seconds", duration<boost::int_least64_t, ratio<1, 30> > (5000));
+
+ test_good<Clock> ("5000 h", hours(5000));
+#if BOOST_CHRONO_VERSION >= 2
+ test_good<Clock>("5000 min", minutes(5000));
+#else
+ test_good<Clock> ("5000 m", minutes(5000));
+#endif
+ test_good<Clock> ("5000 s", seconds(5000));
+ test_good<Clock> ("5000 ms", milliseconds(5000));
+ test_good<Clock> ("5000 ns", nanoseconds(5000));
+ test_good<Clock> ("5000 ds", duration<boost::int_least64_t, deci> (5000));
+ test_good<Clock> ("5000 [1/30]s", duration<boost::int_least64_t, ratio<1, 30> > (5000));
+
+ test_good<Clock> ("5000 milliseconds", seconds(5));
+ test_good<Clock> ("5 milliseconds", nanoseconds(5000000));
+ test_good<Clock> ("4000 ms", seconds(4));
+ test_fail<Clock> ("3001 ms", seconds(3));
+ test_fail_epoch<Clock> ("3001 ms", seconds(3));
+ test_fail_epoch<Clock> ("3001 ms since", seconds(3));
+
+}
+
+#if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
+void check_all_process_cpu_clock()
+{
+ using namespace boost::chrono;
+ using namespace boost;
+ //typedef process_cpu_clock Clock;
+ //test_good<Clock> ("{5000;0;0} nanoseconds", process_cpu_clock::duration(process_cpu_clock::times(5000,0,0)));
+}
+#endif
+
+#if BOOST_CHRONO_VERSION >= 2
+void check_all_system_clock()
+{
+ using namespace boost::chrono;
+ using namespace boost;
+
+ test_good_system_clock ("1970-01-01 02:00:00.000000 +0000", hours(2));
+ test_good_system_clock ("1970-07-28 08:00:00.000000 +0000", hours(5000));
+ test_good_system_clock ("1970-01-04 11:20:00.000000 +0000", minutes(5000));
+ test_good_system_clock ("1970-01-01 01:23:20.000000 +0000", seconds(5000));
+ test_good_system_clock ("1970-01-01 00:00:01.000000 +0000", seconds(1));
+ test_good_system_clock ("1970-01-01 00:00:01.000000 +0000", seconds(1));
+ test_good_system_clock ("1969-12-31 23:59:59.000000 +0000", seconds(-1));
+ test_good_system_clock ("1970-01-01 00:00:00.000000 +0000", seconds(0));
+ test_good_system_clock ("1970-01-01 00:00:00.000000 +0000", seconds(0));
+ test_good_system_clock ("1970-01-01 00:00:05.000000 +0000", milliseconds(5000));
+ test_good_system_clock ("1970-01-01 00:00:00.005000 +0000", microseconds(5000));
+ test_good_system_clock ("1970-01-01 00:00:00.000005 +0000", nanoseconds(5000));
+ test_good_system_clock ("1970-01-01 00:08:20.000000 +0000", duration<boost::int_least64_t, deci> (5000));
+ test_good_system_clock ("1970-01-01 00:02:46.666667 +0000", duration<boost::int_least64_t, ratio<1, 30> > (5000));
+
+ test_good_utc_fmt_system_clock ("1970-01-01 02:00:00", "%Y-%m-%d %H:%M:%S", hours(2));
+ test_good_utc_fmt_system_clock ("1970-01-01 02:00:00", "%F %H:%M:%S", hours(2));
+ test_good_utc_fmt_system_clock ("1970-01-01 02", "%Y-%m-%d %H", hours(2));
+ test_good_utc_fmt_system_clock ("1970-01-01 02", "%F %H", hours(2));
+ test_good_utc_fmt_system_clock ("1970-01-01 02:00:00", "%Y-%m-%d %T", hours(2));
+ test_good_utc_fmt_system_clock ("1970-01-01 02:00", "%Y-%m-%d %R", hours(2));
+ test_good_utc_fmt_system_clock ("% 1970-01-01 02:00", "%% %Y-%m-%d %R", hours(2));
+ //test_good_utc_fmt_system_clock ("1970-01-01 02:00 Thursday January", "%Y-%m-%d %R %A %B", hours(2));
+
+
+// test_fail<Clock> ("3001 ms", seconds(3));
+// test_fail_epoch<Clock> ("3001 ms", seconds(3));
+// test_fail_epoch<Clock> ("3001 ms since", seconds(3));
+
+}
+#endif
+int main()
+{
+ std::cout << "high_resolution_clock=" << std::endl;
+ check_all<boost::chrono::high_resolution_clock> ();
+#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
+ std::cout << "steady_clock=" << std::endl;
+ check_all<boost::chrono::steady_clock> ();
+#endif
+ std::cout << "system_clock=" << std::endl;
+#if BOOST_CHRONO_VERSION >= 2 && defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT
+ check_all_system_clock();
+#else
+ check_all<boost::chrono::system_clock> ();
+#endif
+#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
+ std::cout << "thread_clock="<< std::endl;
+ check_all<boost::chrono::thread_clock>();
+#endif
+
+#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
+ std::cout << "process_real_cpu_clock=" << std::endl;
+ check_all<boost::chrono::process_real_cpu_clock> ();
+#if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
+ std::cout << "process_user_cpu_clock=" << std::endl;
+ check_all<boost::chrono::process_user_cpu_clock> ();
+ std::cout << "process_system_cpu_clock=" << std::endl;
+ check_all<boost::chrono::process_system_cpu_clock> ();
+ std::cout << "process_cpu_clock=" << std::endl;
+ //check_all_process_cpu_clock();
+#endif
+#endif
+
+ return boost::report_errors();
+
+}
+
diff --git a/src/boost/libs/chrono/test/io/time_point_output.cpp b/src/boost/libs/chrono/test/io/time_point_output.cpp
new file mode 100644
index 000000000..6d5b021b1
--- /dev/null
+++ b/src/boost/libs/chrono/test/io/time_point_output.cpp
@@ -0,0 +1,317 @@
+// Copyright 2011 Vicente J. Botet Escriba
+// Copyright (c) Microsoft Corporation 2014
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/chrono_io.hpp>
+#include <sstream>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/chrono/system_clocks.hpp>
+#include <boost/chrono/thread_clock.hpp>
+#include <boost/chrono/process_cpu_clocks.hpp>
+#include <locale>
+#include <ctime>
+#include <cstdio>
+
+template <typename Clock, typename D>
+void test_good_prefix(const char* str, D d)
+{
+ std::ostringstream out;
+ boost::chrono::time_point<Clock, D> tp(d);
+ out << tp;
+ BOOST_TEST(out.good());
+ //std::cout << "Expected= " << std::string(str) + boost::chrono::clock_string<Clock, char>::since() << std::endl;
+ //std::cout << "Obtained= " << out.str() << std::endl;
+ BOOST_TEST( (out.str() == std::string(str) + boost::chrono::clock_string<Clock, char>::since()));
+}
+
+template <typename D>
+void test_good_prefix_system_clock(const char* str, D d)
+{
+ typedef boost::chrono::system_clock Clock;
+
+ std::ostringstream out;
+ boost::chrono::time_point<Clock, D> tp(d);
+ out << tp;
+ BOOST_TEST(out.good());
+
+ std::cout << "Expected= " << str << std::endl;
+ std::cout << "Obtained= " << out.str() << std::endl;
+ BOOST_TEST( (out.str() == std::string(str) ));
+}
+
+template <typename Clock, typename D>
+void test_good_symbol(const char* str, D d)
+{
+ std::ostringstream out;
+ boost::chrono::time_point<Clock, D> tp(d);
+#if BOOST_CHRONO_VERSION>=2
+ out << boost::chrono::duration_fmt(boost::chrono::duration_style::symbol) << tp;
+#else
+ out << boost::chrono::duration_short << tp;
+#endif
+ BOOST_TEST(out.good());
+ BOOST_TEST( (out.str() == std::string(str) + boost::chrono::clock_string<Clock, char>::since()));
+}
+
+#if BOOST_CHRONO_VERSION>=2
+template <typename D>
+void test_good_symbol_system_clock(const char* str, D d)
+{
+ typedef boost::chrono::system_clock Clock;
+
+ std::ostringstream out;
+ boost::chrono::time_point<Clock, D> tp(d);
+ out << boost::chrono::duration_fmt(boost::chrono::duration_style::symbol) << tp;
+ BOOST_TEST(out.good());
+ std::cout << "Expected= " << str << std::endl;
+ std::cout << "Obtained= " << out.str() << std::endl;
+ BOOST_TEST( (out.str() == std::string(str) ));
+}
+
+template <typename D>
+void test_good_utc_fmt_system_clock(const char* str, const char* fmt, D d)
+{
+ typedef boost::chrono::system_clock Clock;
+
+ std::ostringstream out;
+ boost::chrono::time_point<Clock, D> tp(d);
+ boost::chrono::time_fmt_io_saver<> fmts(out);
+ boost::chrono::timezone_io_saver tzs(out);
+ out << time_fmt(boost::chrono::timezone::utc, fmt) << tp;
+ BOOST_TEST(out.good());
+ std::cout << "Expected= " << str << std::endl;
+ std::cout << "Obtained= " << out.str() << std::endl;
+ BOOST_TEST_EQ( out.str() , std::string(str) );
+}
+
+template <typename D>
+void test_good_utc_fmt_system_clock2(const char* str, const char* fmt, D d)
+{
+ typedef boost::chrono::system_clock Clock;
+
+ std::ostringstream out;
+ boost::chrono::time_point<Clock, D> tp(d);
+ boost::chrono::time_fmt_io_saver<> fmts(out, fmt);
+ boost::chrono::timezone_io_saver tzs(out, boost::chrono::timezone::utc);
+ out << tp;
+ BOOST_TEST(out.good());
+ std::cout << "Expected= " << str << std::endl;
+ std::cout << "Obtained= " << out.str() << std::endl;
+ BOOST_TEST_EQ( out.str() , std::string(str) );
+}
+
+template<typename Clock, typename D>
+void test_good(const char* str, D d, boost::chrono::duration_style style)
+{
+ std::ostringstream out;
+ boost::chrono::time_point<Clock,D> tp(d);
+ out << boost::chrono::duration_fmt(style) << tp;
+ BOOST_TEST(out.good());
+ BOOST_TEST((out.str() == std::string(str)+boost::chrono::clock_string<Clock,char>::since()));
+}
+
+template<typename D>
+void test_good_system_clock(const char* str, D d, boost::chrono::duration_style style)
+{
+ typedef boost::chrono::system_clock Clock;
+
+ std::ostringstream out;
+ boost::chrono::time_point<Clock,D> tp(d);
+ out << boost::chrono::duration_fmt(style) << tp;
+ BOOST_TEST(out.good());
+ std::cout << "Expected= " << str << std::endl;
+ std::cout << "Obtained= " << out.str() << std::endl;
+ BOOST_TEST((out.str() == std::string(str) ));
+}
+#endif
+
+template <typename Clock>
+void check_all()
+{
+ using namespace boost::chrono;
+ using namespace boost;
+
+#if BOOST_CHRONO_VERSION>=2
+ test_good<Clock>("2 hours", hours(2), duration_style::prefix);
+ test_good<Clock>("2 h", hours(2), duration_style::symbol);
+#endif
+
+ test_good_prefix<Clock> ("2 hours", hours(2));
+ test_good_prefix<Clock> ("2 minutes", minutes(2));
+ test_good_prefix<Clock> ("2 seconds", seconds(2));
+ test_good_prefix<Clock> ("1 second", seconds(1));
+ test_good_prefix<Clock> ("-1 second", seconds(-1));
+ test_good_prefix<Clock> ("0 seconds", seconds(0));
+ test_good_prefix<Clock> ("2 milliseconds", milliseconds(2));
+ test_good_prefix<Clock> ("2 microseconds", microseconds(2));
+ test_good_prefix<Clock> ("2 nanoseconds", nanoseconds(2));
+ test_good_prefix<Clock> ("2 deciseconds", duration<boost::int_least64_t, deci> (2));
+ test_good_prefix<Clock> ("2 [1/30]seconds", duration<boost::int_least64_t, ratio<1, 30> > (2));
+
+ test_good_symbol<Clock> ("2 h", hours(2));
+#if BOOST_CHRONO_VERSION>=2
+ test_good_symbol<Clock>("2 min", minutes(2));
+#else
+ test_good_symbol<Clock> ("2 m", minutes(2));
+#endif
+ test_good_symbol<Clock> ("2 s", seconds(2));
+ test_good_symbol<Clock> ("2 ms", milliseconds(2));
+ test_good_symbol<Clock> ("2 ns", nanoseconds(2));
+ test_good_symbol<Clock> ("2 ds", duration<boost::int_least64_t, deci> (2));
+ test_good_symbol<Clock> ("2 [1/30]s", duration<boost::int_least64_t, ratio<1, 30> > (2));
+}
+
+#if BOOST_CHRONO_VERSION >= 2
+void check_all_system_clock()
+{
+ using namespace boost::chrono;
+ using namespace boost;
+
+ test_good_system_clock("1970-01-01 02:00:00.000000000 +0000", hours(2), duration_style::prefix);
+ test_good_system_clock("1970-01-01 02:00:00.000000000 +0000", hours(2), duration_style::symbol);
+
+ test_good_prefix_system_clock("1970-01-01 02:00:00.000000000 +0000", hours(2));
+ test_good_prefix_system_clock("1970-01-01 00:02:00.000000000 +0000", minutes(2));
+ test_good_prefix_system_clock("1970-01-01 00:00:02.000000000 +0000", seconds(2));
+ test_good_prefix_system_clock("1970-01-01 00:00:01.000000000 +0000", seconds(1));
+ test_good_prefix_system_clock("1969-12-31 23:59:59.000000000 +0000", seconds(-1));
+ test_good_prefix_system_clock("1970-01-01 00:00:00.000000000 +0000", seconds(0));
+ test_good_prefix_system_clock("1970-01-01 00:00:00.002000000 +0000", milliseconds(2));
+ test_good_prefix_system_clock("1970-01-01 00:00:00.000002000 +0000", microseconds(2));
+ test_good_prefix_system_clock("1970-01-01 00:00:00.000000002 +0000", nanoseconds(2));
+ test_good_prefix_system_clock("1970-01-01 00:00:00.200000000 +0000", duration<boost::int_least64_t, deci> (2));
+ test_good_prefix_system_clock("1970-01-01 00:00:00.066666667 +0000", duration<boost::int_least64_t, ratio<1, 30> > (2));
+
+ test_good_symbol_system_clock("1970-01-01 02:00:00.000000000 +0000", hours(2));
+ test_good_symbol_system_clock("1970-01-01 00:02:00.000000000 +0000", minutes(2));
+ test_good_symbol_system_clock("1970-01-01 00:00:02.000000000 +0000", seconds(2));
+ test_good_symbol_system_clock("1970-01-01 00:00:00.002000000 +0000", milliseconds(2));
+ test_good_symbol_system_clock("1970-01-01 00:00:00.000000002 +0000", nanoseconds(2));
+ test_good_symbol_system_clock("1970-01-01 00:00:00.200000000 +0000", duration<boost::int_least64_t, deci> (2));
+ test_good_symbol_system_clock("1970-01-01 00:00:00.066666667 +0000", duration<boost::int_least64_t, ratio<1, 30> > (2));
+
+ test_good_utc_fmt_system_clock("1970-01-01 02:00:00", "%Y-%m-%d %H:%M:%S", hours(2));
+ test_good_utc_fmt_system_clock("1970-01-01 02", "%Y-%m-%d %H", hours(2));
+#if ! defined(BOOST_CHRONO_WINDOWS_API)
+ test_good_utc_fmt_system_clock ("1970-01-01 02:00:00", "%Y-%m-%d %T", hours(2));
+ test_good_utc_fmt_system_clock ("1970-01-01 02:00", "%Y-%m-%d %R", hours(2));
+ test_good_utc_fmt_system_clock ("% 1970-01-01 02:00", "%% %Y-%m-%d %R", hours(2));
+ test_good_utc_fmt_system_clock ("1970-01-01 02:00 Thursday January", "%Y-%m-%d %R %A %B", hours(2));
+#endif
+ test_good_utc_fmt_system_clock2("1970-01-01 02:00:00", "%Y-%m-%d %H:%M:%S", hours(2));
+ test_good_utc_fmt_system_clock2("1970-01-01 02", "%Y-%m-%d %H", hours(2));
+#if ! defined(BOOST_CHRONO_WINDOWS_API)
+ test_good_utc_fmt_system_clock2 ("1970-01-01 02:00:00", "%Y-%m-%d %T", hours(2));
+ test_good_utc_fmt_system_clock2 ("1970-01-01 02:00", "%Y-%m-%d %R", hours(2));
+ test_good_utc_fmt_system_clock2 ("% 1970-01-01 02:00", "%% %Y-%m-%d %R", hours(2));
+ test_good_utc_fmt_system_clock2 ("1970-01-01 02:00 Thursday January", "%Y-%m-%d %R %A %B", hours(2));
+#endif
+}
+
+
+#endif
+#if defined BOOST_CHRONO_INTERNAL_GMTIME
+#elif BOOST_CHRONO_VERSION == 2
+void test_gmtime(std::time_t t)
+{
+ std::cout << "t " << t << std::endl;
+ std::puts(ctime(&t));
+ std::tm tm;
+ std::memset(&tm, 0, sizeof(std::tm));
+ if (boost::chrono::detail::internal_gmtime(&t, &tm))
+ {
+ tm.tm_isdst = -1;
+ (void)mktime(&tm);
+ std::tm tm2;
+ std::memset(&tm2, 0, sizeof(std::tm));
+ if (gmtime_r(&t, &tm2))
+ {
+ tm2.tm_isdst = -1;
+ (void)mktime(&tm2);
+
+ BOOST_TEST_EQ( tm.tm_year , tm2.tm_year );
+ BOOST_TEST_EQ( tm.tm_mon , tm2.tm_mon );
+ BOOST_TEST_EQ( tm.tm_mday , tm2.tm_mday );
+ BOOST_TEST_EQ( tm.tm_hour , tm2.tm_hour);
+ BOOST_TEST_EQ( tm.tm_min , tm2.tm_min );
+ BOOST_TEST_EQ( tm.tm_sec , tm2.tm_sec );
+ BOOST_TEST_EQ( tm.tm_wday , tm2.tm_wday );
+ BOOST_TEST_EQ( tm.tm_yday , tm2.tm_yday );
+ BOOST_TEST_EQ( tm.tm_isdst , tm2.tm_isdst );
+ }
+ }
+
+}
+#endif
+
+
+int main()
+{
+#if defined BOOST_CHRONO_INTERNAL_GMTIME
+#elif BOOST_CHRONO_VERSION == 2
+ test_gmtime( 0 );
+ test_gmtime( -1 );
+ test_gmtime( +1 );
+ test_gmtime( 0 - (3600 * 24) );
+ test_gmtime( -1 - (3600 * 24) );
+ test_gmtime( +1 - (3600 * 24) );
+ test_gmtime( 0 + (3600 * 24) );
+ test_gmtime( -1 + (3600 * 24) );
+ test_gmtime( +1 + (3600 * 24) );
+ test_gmtime( 0 + 365*(3600 * 24) );
+ test_gmtime( 0 + 10LL*365*(3600 * 24) );
+ test_gmtime( 0 + 15LL*365*(3600 * 24) );
+ test_gmtime( 0 + 17LL*365*(3600 * 24) );
+ test_gmtime( 0 + 18LL*365*(3600 * 24) );
+ test_gmtime( 0 + 19LL*365*(3600 * 24) );
+ test_gmtime( 0 + 19LL*365*(3600 * 24)+ (3600 * 24));
+ test_gmtime( 0 + 19LL*365*(3600 * 24)+ 3*(3600 * 24));
+ test_gmtime( 0 + 19LL*365*(3600 * 24)+ 4*(3600 * 24));
+ test_gmtime( 0 + 20LL*365*(3600 * 24) );
+ test_gmtime( 0 + 40LL*365*(3600 * 24) );
+#endif
+
+ std::cout << "high_resolution_clock=" << std::endl;
+ check_all<boost::chrono::high_resolution_clock> ();
+#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
+ std::cout << "steady_clock=" << std::endl;
+ check_all<boost::chrono::steady_clock> ();
+#endif
+ std::cout << "system_clock=" << std::endl;
+#if BOOST_CHRONO_VERSION >= 2 && defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT
+ check_all_system_clock();
+#else
+ check_all<boost::chrono::system_clock> ();
+#endif
+
+#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
+ std::cout << "thread_clock="<< std::endl;
+ check_all<boost::chrono::thread_clock>();
+#endif
+
+#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
+ std::cout << "process_real_cpu_clock=" << std::endl;
+ check_all<boost::chrono::process_real_cpu_clock> ();
+#if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
+ std::cout << "process_user_cpu_clock=" << std::endl;
+ check_all<boost::chrono::process_user_cpu_clock> ();
+ std::cout << "process_system_cpu_clock=" << std::endl;
+ check_all<boost::chrono::process_system_cpu_clock> ();
+ std::cout << "process_cpu_clock=" << std::endl;
+ check_all<boost::chrono::process_cpu_clock> ();
+#endif
+#endif
+
+#if defined BOOST_CHRONO_INTERNAL_GMTIME
+#elif BOOST_CHRONO_VERSION == 2
+ boost::chrono::system_clock::time_point tp = boost::chrono::system_clock::now();
+ std::cout << tp << std::endl;
+ time_t t = boost::chrono::system_clock::to_time_t(tp);
+ test_gmtime( t );
+#endif
+
+ return boost::report_errors();
+
+}
+
diff --git a/src/boost/libs/chrono/test/one_obj.cpp b/src/boost/libs/chrono/test/one_obj.cpp
new file mode 100644
index 000000000..ed8d61a09
--- /dev/null
+++ b/src/boost/libs/chrono/test/one_obj.cpp
@@ -0,0 +1,23 @@
+// boost win32_test.cpp -----------------------------------------------------//
+
+// Copyright 2010 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// See http://www.boost.org/libs/chrono for documentation.
+#include <iostream>
+#include <boost/chrono/chrono.hpp>
+#include <boost/chrono/chrono_io.hpp>
+
+void another();
+
+int main()
+{
+ boost::chrono::steady_clock::time_point t1=boost::chrono::steady_clock::now();
+ another();
+ boost::chrono::steady_clock::time_point t2=boost::chrono::steady_clock::now();
+ std::cout << t2-t1 << std::endl;
+ return 0;
+}
+
diff --git a/src/boost/libs/chrono/test/rep.h b/src/boost/libs/chrono/test/rep.h
new file mode 100644
index 000000000..b7e4ca273
--- /dev/null
+++ b/src/boost/libs/chrono/test/rep.h
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#ifndef REP_H
+#define REP_H
+
+#include <boost/config.hpp>
+
+class Rep
+{
+public:
+ int data_;
+ BOOST_CONSTEXPR Rep() : data_() {}
+ explicit BOOST_CONSTEXPR Rep(int i) : data_(i) {}
+
+ BOOST_CONSTEXPR bool operator==(int i) const {return data_ == i;}
+ BOOST_CONSTEXPR bool operator==(const Rep& r) const {return data_ == r.data_;}
+
+ Rep& operator*=(Rep x) {data_ *= x.data_; return *this;}
+ Rep& operator/=(Rep x) {data_ /= x.data_; return *this;}
+};
+
+#if 0
+namespace std {
+
+ template <>
+ struct numeric_limits<Rep>
+ {
+ static BOOST_CONSTEXPR Rep max BOOST_PREVENT_MACRO_SUBSTITUTION ()
+ {
+ return Rep((std::numeric_limits<int>::max)());
+ }
+
+ };
+} // namespace std
+
+namespace boost {
+namespace chrono {
+template <>
+struct duration_values<Rep>
+{
+ static BOOST_CONSTEXPR Rep zero() {return Rep(0);}
+ static BOOST_CONSTEXPR Rep max BOOST_PREVENT_MACRO_SUBSTITUTION ()
+ {
+ return Rep((std::numeric_limits<int>::max)());
+ }
+
+ static BOOST_CONSTEXPR Rep min BOOST_PREVENT_MACRO_SUBSTITUTION ()
+ {
+ return Rep(detail::numeric_limits<Rep>::lowest());
+ }
+};
+
+} // namespace chrono
+} // namespace boost
+#endif
+#endif // REP_H
diff --git a/src/boost/libs/chrono/test/run_timer_test.cpp b/src/boost/libs/chrono/test/run_timer_test.cpp
new file mode 100644
index 000000000..0f14a73e5
--- /dev/null
+++ b/src/boost/libs/chrono/test/run_timer_test.cpp
@@ -0,0 +1,226 @@
+// boost run_timer_test.cpp -----------------------------------------------------//
+
+// Copyright Beman Dawes 2006, 2008
+// Copyright 2009 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// See http://www.boost.org/libs/chrono for documentation.
+
+#include <boost/chrono/process_times.hpp>
+#include <boost/chrono/timer.hpp>
+#include <cstdlib> // for atol()
+#include <iostream>
+#include <sstream>
+#include <locale>
+#include <ctime>
+#include <cmath> // for sqrt(), used to burn time
+
+using boost::chrono::run_timer;
+using boost::system::error_code;
+
+#include <boost/detail/lightweight_test.hpp>
+
+//#define BOOST_TEST(expr) if (!(expr)) std::cout << "*****ERROR*****\n"
+
+#define CHECK_REPORT(Timer,String_Stream,R,U,S,Expected_String) \
+ check_report(Timer, String_Stream, R, U, S, Expected_String, __LINE__)
+
+
+namespace
+{
+ typedef boost::chrono::nanoseconds ns;
+
+ bool check_report( run_timer & tmr, std::stringstream & ss,
+ run_timer::duration r, run_timer::duration u, run_timer::duration s,
+ const std::string & expected, int line )
+ {
+ tmr.test_report(r,u,s);
+ bool result(true);
+ if ( ss.str() != expected )
+ {
+ std::cout << "run_timer_test.cpp(" << line << ") : error: actual output \""
+ << ss.str() << "\" != expected \"" << expected << "\"\n";
+ result = false;
+ }
+ return result;
+ }
+
+ void run_timer_constructor_overload_test()
+ {
+ // exercise each supported combination of constructor arguments
+
+ std::ostream & os = std::cout;
+ const int pl = 9;
+ boost::system::error_code ec;
+
+ run_timer t1;
+ run_timer t2( os );
+ run_timer t3( ec );
+ run_timer t4( os, ec );
+ run_timer t5( pl );
+ run_timer t6( os, pl );
+ run_timer t7( pl, ec );
+ run_timer t8( os, pl, ec );
+ run_timer t9( "t9, default places, r %r, c %c, p %p, u %u, s %s\n" );
+ run_timer t10( os, "t10, default places, r %r, c %c, p %p, u %u, s %s\n" );
+ run_timer t11( "t11, default places, r %r, c %c, p %p, u %u, s %s\n", ec );
+ run_timer t12( os, "t12, default places, r %r, c %c, p %p, u %u, s %s\n", ec );
+ run_timer t13( pl, "t13, explicitly code places, r %r, c %c, p %p, u %u, s %s\n" );
+ run_timer t14( "t14, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", pl );
+ run_timer t15( os, pl, "t15, explicitly code places, r %r, c %c, p %p, u %u, s %s\n" );
+ run_timer t16( os, "t16, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", pl );
+ run_timer t17( pl, "t17, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", ec );
+ run_timer t18( "t18, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", pl, ec );
+ run_timer t19( os, pl, "t19, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", ec );
+ run_timer t20( os, "t20, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", pl, ec );
+
+ std::cout << "Burn some time so run_timers have something to report...";
+ boost::chrono::timer<boost::chrono::high_resolution_clock> t;
+ while ( t.elapsed() < boost::chrono::seconds(1) ) {}
+ std::cout << "\n";
+ std::cout << run_timer::default_places() << " default places\n";
+ std::cout << pl << " explicitly coded places\n";
+ }
+
+ // accuracy test
+ void accuracy_test( int argc, char * argv[] )
+ {
+ long timeout_in_secs = 1;
+ if ( argc > 1 ) timeout_in_secs = std::atol( argv[1] );
+ std::cout << "accuracy test for " << timeout_in_secs << " second(s)...";
+
+ std::clock_t timeout_in_clock_t = std::clock();
+ timeout_in_clock_t += (timeout_in_secs * CLOCKS_PER_SEC);
+
+ boost::chrono::system_timer sys;
+#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
+ boost::chrono::steady_timer mono;
+#endif
+ boost::chrono::high_resolution_timer hires;
+ boost::chrono::process_timer process;
+
+ std::clock_t now;
+ do
+ {
+ now = std::clock();
+ } while ( now < timeout_in_clock_t );
+
+ boost::chrono::system_timer::duration sys_dur = sys.elapsed();
+#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
+ boost::chrono::steady_timer::duration mono_dur = mono.elapsed();
+#endif
+ boost::chrono::high_resolution_timer::duration hires_dur = hires.elapsed();
+ boost::chrono::process_times times;
+ process.elapsed( times );
+
+ std::cout << std::endl;
+
+ ns timeout_in_nanoseconds( static_cast<long long>(timeout_in_secs) * 1000000000LL );
+
+ // Allow 20% leeway. Particularly on Linux, there seems to be a large discrepancy
+ // between std::clock() and higher resolution clocks.
+ ns maximum_delta ( static_cast<long long>(timeout_in_nanoseconds.count() * 0.20 ) );
+
+ std::cout << timeout_in_nanoseconds.count() << " timeout_in_nanoseconds\n";
+ std::cout << maximum_delta.count() << " maximum_delta\n";
+
+ std::cout << sys_dur.count() << " sys_dur\n";
+
+ BOOST_TEST( sys_dur > timeout_in_nanoseconds - maximum_delta
+ && sys_dur < timeout_in_nanoseconds + maximum_delta );
+
+#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
+ std::cout << mono_dur.count() << " mono_dur\n";
+
+ BOOST_TEST( mono_dur > timeout_in_nanoseconds - maximum_delta
+ && mono_dur < timeout_in_nanoseconds + maximum_delta );
+#endif
+
+ std::cout << hires_dur.count() << " hires_dur\n";
+
+ BOOST_TEST( hires_dur > timeout_in_nanoseconds - maximum_delta
+ && hires_dur < timeout_in_nanoseconds + maximum_delta );
+
+ std::cout << times.real.count() << " times.real\n";
+
+ BOOST_TEST( times.real > timeout_in_nanoseconds - maximum_delta
+ && times.real < timeout_in_nanoseconds + maximum_delta );
+ }
+
+ // report test
+
+ void report_test()
+ {
+ {
+ std::stringstream ss;
+ run_timer t(ss);
+ BOOST_TEST( CHECK_REPORT(t, ss, ns(0), ns(0), ns(0),
+ "\nreal 0.000s, cpu 0.000s (0.0%), user 0.000s, system 0.000s\n" ) );
+ }
+
+ {
+ std::stringstream ss;
+ run_timer t(ss);
+ BOOST_TEST( CHECK_REPORT(t, ss, ns(3000000000LL), ns(2000000000LL), ns(1000000000LL),
+ "\nreal 3.000s, cpu 3.000s (100.0%), user 2.000s, system 1.000s\n" ) );
+ }
+
+ {
+ std::stringstream ss;
+ run_timer t( ss, "9 places: r %r, c %c, p %p, u %u, s %s", 9 );
+ BOOST_TEST( CHECK_REPORT(t, ss, ns(3000000003LL), ns(2000000002LL), ns(1000000001LL),
+ "9 places: "
+ "r 3.000000003, c 3.000000003, p 100.0, u 2.000000002, s 1.000000001" ) );
+ }
+ }
+
+ // process_timer_test
+
+ void process_timer_test()
+ {
+ std::cout << "process_timer_test..." << std::flush;
+
+ boost::chrono::process_timer t;
+ double res=0; // avoids optimization
+ for (long i = 0; i < 10000000L; ++i)
+ {
+ res+=std::sqrt( static_cast<double>(i) ); // avoids optimization
+ }
+
+ boost::chrono::process_times times;
+ times.real = times.system = times.user = ns(0);
+
+ BOOST_TEST( times.real == ns(0) );
+ BOOST_TEST( times.user == ns(0) );
+ BOOST_TEST( times.system == ns(0) );
+
+ t.elapsed( times );
+ std::cout << "\n";
+
+ std::cout << times.real.count() << " times.real\n";
+ std::cout << times.user.count() << " times.user\n";
+ std::cout << times.system.count() << " times.system\n";
+ std::cout << (times.user+times.system).count() << " times.user+system\n";
+ BOOST_TEST( times.real > ns(1) );
+
+ BOOST_TEST( times.user+times.system > ns(1) );
+
+ std::cout << "complete " << res << std::endl;
+ }
+}
+
+int main( int argc, char * argv[] )
+{
+ std::locale loc( "" ); // test with appropriate locale
+ std::cout.imbue( loc );
+
+ accuracy_test( argc, argv );
+ run_timer_constructor_overload_test();
+ process_timer_test();
+ report_test();
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/chrono/test/test_10631.cpp b/src/boost/libs/chrono/test/test_10631.cpp
new file mode 100644
index 000000000..2bce583b6
--- /dev/null
+++ b/src/boost/libs/chrono/test/test_10631.cpp
@@ -0,0 +1,61 @@
+// Copyright 2015 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+// See http://www.boost.org/libs/chrono for documentation.
+
+#define BOOST_CHRONO_VERION 2
+#include <iostream>
+#include <boost/chrono/chrono.hpp>
+#include <boost/chrono/chrono_io.hpp>
+
+// a custom clock
+// here based on boost's own system_clock
+class MyMillenniumClock
+{
+public:
+ typedef boost::chrono::system_clock::rep rep;
+ typedef boost::chrono::system_clock::period period;
+ typedef boost::chrono::duration<rep, period> duration;
+ typedef boost::chrono::time_point<MyMillenniumClock> time_point;
+
+ BOOST_STATIC_CONSTEXPR bool is_steady = boost::chrono::system_clock::is_steady;
+
+public:
+ /// Returns a time_point representing the current value of the clock.
+ static time_point now() {
+ return time_point(boost::chrono::system_clock::now().time_since_epoch() - boost::chrono::hours(30*365));
+ }
+};
+
+
+namespace boost
+{
+ namespace chrono
+ {
+ template <class CharT>
+ struct clock_string<MyMillenniumClock, CharT>
+ {
+ static std::basic_string<CharT> name() {
+ static const CharT a[] = {'M', 'y', 'M', 'i', 'l', 'l', 'e', 'n', 'n', 'i', 'u', 'm', 'C', 'l', 'o', 'c', 'k'};
+ return std::basic_string<CharT>(a, a + sizeof(a)/sizeof(a[0]));
+ }
+ static std::basic_string<CharT> since() {
+ static const CharT a[] = {' ', 's', 'i', 'n', 'c', 'e', ' ', 'y', 'e', 'a', 'r', ' ', '2', 'k'};
+ return std::basic_string<CharT>(a, a + sizeof(a)/sizeof(a[0]));
+ }
+ };
+ }
+}
+
+template <typename CharT, typename TPUFacet>
+std::basic_string<CharT> get_epoch_custom(MyMillenniumClock, TPUFacet&)
+{
+ return boost::chrono::clock_string<MyMillenniumClock,CharT>::since();
+}
+
+int main()
+{
+ std::cout << boost::chrono::steady_clock::now() << std::endl;
+ std::cout << MyMillenniumClock::now() << std::endl;
+ return 0;
+}
diff --git a/src/boost/libs/chrono/test/test_10778.cpp b/src/boost/libs/chrono/test/test_10778.cpp
new file mode 100644
index 000000000..7693cd3fe
--- /dev/null
+++ b/src/boost/libs/chrono/test/test_10778.cpp
@@ -0,0 +1,19 @@
+// Copyright 2015 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+// See http://www.boost.org/libs/chrono for documentation.
+
+//#define BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
+#include <boost/chrono.hpp>
+#include <boost/chrono/chrono_io.hpp>
+#include <atomic>
+
+void test()
+{
+ std::atomic<boost::chrono::milliseconds> ms; // error C2338: atomic<T> requires T to be trivially copyable.
+}
+
+int main() {
+ test();
+ return 1;
+}
diff --git a/src/boost/libs/chrono/test/test_11006.cpp b/src/boost/libs/chrono/test/test_11006.cpp
new file mode 100644
index 000000000..cf40fc051
--- /dev/null
+++ b/src/boost/libs/chrono/test/test_11006.cpp
@@ -0,0 +1,21 @@
+// Copyright 2015 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+// See http://www.boost.org/libs/chrono for documentation.
+
+//#define BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
+#define BOOST_CHRONO_VERSION 2
+#include <iostream>
+#include <boost/chrono/io/time_point_io.hpp>
+
+
+int main() {
+ {
+ boost::chrono::time_fmt_io_saver<> tmp(std::cout);
+ }
+ {
+ boost::chrono::time_fmt_io_saver<> tmp(std::cout, "%Y-%m-%d %H:%M:%S");
+ }
+ return 0;
+}
+
diff --git a/src/boost/libs/chrono/test/test_11012.cpp b/src/boost/libs/chrono/test/test_11012.cpp
new file mode 100644
index 000000000..249b9b891
--- /dev/null
+++ b/src/boost/libs/chrono/test/test_11012.cpp
@@ -0,0 +1,27 @@
+// Copyright 2015 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+// See http://www.boost.org/libs/chrono for documentation.
+
+//#define BOOST_CHRONO_VERSION 1
+#define BOOST_CHRONO_VERSION 2
+#include <iostream>
+#include <boost/rational.hpp>
+#include <boost/chrono/chrono.hpp>
+//#define BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
+#include <boost/chrono/chrono_io.hpp>
+
+int main()
+{
+ {
+ typedef boost::chrono::duration<float> RationalSeconds;
+ RationalSeconds d(0.5);
+ std::cout << d << std::endl;
+ }
+ {
+ typedef boost::chrono::duration<boost::rational<int> > RationalSeconds;
+ RationalSeconds d;
+ std::cout << d << std::endl;
+ }
+ return 0;
+}
diff --git a/src/boost/libs/chrono/test/test_12176.cpp b/src/boost/libs/chrono/test/test_12176.cpp
new file mode 100644
index 000000000..253d88a15
--- /dev/null
+++ b/src/boost/libs/chrono/test/test_12176.cpp
@@ -0,0 +1,11 @@
+// Copyright 2016 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+// See http://www.boost.org/libs/chrono for documentation.
+
+#include <boost/chrono/chrono.hpp>
+
+int main()
+{
+ return 0;
+}
diff --git a/src/boost/libs/chrono/test/test_7868.cpp b/src/boost/libs/chrono/test/test_7868.cpp
new file mode 100644
index 000000000..38f658b8c
--- /dev/null
+++ b/src/boost/libs/chrono/test/test_7868.cpp
@@ -0,0 +1,81 @@
+// Copyright 2013 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+// See http://www.boost.org/libs/chrono for documentation.
+
+#define BOOST_CHRONO_VERSION 2
+//#define BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT 1
+
+#include <sstream>
+#include <iostream>
+#include <boost/chrono/chrono_io.hpp>
+#include <boost/chrono/floor.hpp>
+#include <boost/chrono/round.hpp>
+#include <boost/chrono/ceil.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <cstdio>
+
+int main()
+{
+ using namespace boost;
+ using namespace boost::chrono;
+ boost::chrono::system_clock::time_point atnow= boost::chrono::system_clock::now();
+ {
+ std::stringstream strm;
+ std::stringstream strm2;
+ // does not change anything: strm<<time_fmt(boost::chrono::timezone::utc);
+ // does not change anything: strm2<<time_fmt(boost::chrono::timezone::utc);
+ boost::chrono::system_clock::time_point atnow2;
+ strm<<atnow<<std::endl;
+ time_t t = boost::chrono::system_clock::to_time_t(atnow);
+ std::cout << "A:" << std::endl;
+ std::puts(ctime(&t));
+ std::cout << "A:" << std::endl;
+ std::cout << "A:" << strm.str()<< std::endl;
+ std::cout << "A:" << atnow.time_since_epoch().count() << std::endl;
+ strm>>atnow2;
+ strm2<<atnow2<<std::endl;
+ std::cout << "B:" << strm2.str()<< std::endl;
+ std::cout << "B:" << atnow2.time_since_epoch().count()<< std::endl;
+ BOOST_TEST_EQ(atnow.time_since_epoch().count(), atnow2.time_since_epoch().count());
+
+ // 1 sec wrong:
+ std::cout << "diff:" << boost::chrono::duration_cast<microseconds>(atnow2 - atnow).count() <<std::endl;
+ BOOST_TEST_EQ(boost::chrono::duration_cast<microseconds>(atnow2 - atnow).count(), 0);
+ std::stringstream formatted;
+ formatted << time_fmt(boost::chrono::timezone::utc, "%Y-%m-%d %H:%M:%S");
+ formatted << "actual:"<< atnow <<std::endl;
+ formatted << "parsed:"<< atnow2 <<std::endl;
+ std::cout << formatted.str();
+ std::stringstream formatted1;
+ formatted1 << time_fmt(boost::chrono::timezone::utc, "%Y-%m-%d %H:%M:%S");
+ formatted1 << atnow ;
+ std::stringstream formatted2;
+ formatted2 << time_fmt(boost::chrono::timezone::utc, "%Y-%m-%d %H:%M:%S");
+ formatted2 << atnow2 ;
+ BOOST_TEST_EQ(formatted1.str(), formatted2.str());
+
+
+ }
+
+ {
+ std::cout << "FORMATTED" << std::endl;
+ std::stringstream strm;
+ std::stringstream strm2;
+ boost::chrono::system_clock::time_point atnow2;
+ // the final second mark is always parsed as 01
+ strm<<time_fmt(boost::chrono::timezone::utc, "%Y-%m-%d %H:%M:%S");
+ strm2<<time_fmt(boost::chrono::timezone::utc, "%Y-%m-%d %H:%M:%S");
+ strm<<atnow<<std::endl;
+ std::cout << "actual:" << strm.str()<< std::endl;
+ strm>>atnow2;
+ strm2<<atnow2<<std::endl;
+ // the final second mark is always parsed as 01
+ std::cout << "parsed:" << strm2.str()<< std::endl;
+ //BOOST_TEST_EQ(atnow, atnow2); // fails because the pattern doesn't contains nanoseconds
+ //BOOST_TEST_EQ(atnow.time_since_epoch().count(), atnow2.time_since_epoch().count()); // fails because the pattern doesn't contains nanoseconds
+ BOOST_TEST_EQ(boost::chrono::duration_cast<seconds>(atnow2 - atnow).count(), 0);
+
+ }
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/chrono/test/test_9337.cpp b/src/boost/libs/chrono/test/test_9337.cpp
new file mode 100644
index 000000000..9f3dd7e09
--- /dev/null
+++ b/src/boost/libs/chrono/test/test_9337.cpp
@@ -0,0 +1,27 @@
+//#define BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
+#include <iostream>
+#include <unistd.h>
+#include <boost/chrono.hpp>
+#include <boost/chrono/chrono_io.hpp>
+
+using namespace std;
+using namespace boost::chrono;
+
+template <typename Clock>
+void test()
+{
+ typename Clock::time_point start=Clock::now();
+ sleep(1);
+ typename Clock::time_point stop=Clock::now();
+ cout<<stop-start<<endl;
+ cout << start <<endl;
+ cout << stop <<endl;
+}
+
+int main() {
+ test<process_cpu_clock>();
+ test<process_real_cpu_clock>();
+ test<process_user_cpu_clock>();
+ test<process_system_cpu_clock>();
+ return 1;
+}
diff --git a/src/boost/libs/chrono/test/time_point/arithmetic_ext_pass.cpp b/src/boost/libs/chrono/test/time_point/arithmetic_ext_pass.cpp
new file mode 100644
index 000000000..6543ac1eb
--- /dev/null
+++ b/src/boost/libs/chrono/test/time_point/arithmetic_ext_pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#define BOOST_CHRONO_EXTENSIONS
+#include <boost/chrono/chrono.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#ifdef BOOST_NO_CXX11_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
+
+int main()
+{
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ t += 2;
+ BOOST_TEST(t.time_since_epoch() == Duration(5));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ t++;
+ BOOST_TEST(t.time_since_epoch() == Duration(4));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ ++t;
+ BOOST_TEST(t.time_since_epoch() == Duration(4));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ t -= 2;
+ BOOST_TEST(t.time_since_epoch() == Duration(1));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ t--;
+ BOOST_TEST(t.time_since_epoch() == Duration(2));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ --t;
+ BOOST_TEST(t.time_since_epoch() == Duration(2));
+ }
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/chrono/test/time_point/arithmetic_pass.cpp b/src/boost/libs/chrono/test/time_point/arithmetic_pass.cpp
new file mode 100644
index 000000000..3cfe2e1fa
--- /dev/null
+++ b/src/boost/libs/chrono/test/time_point/arithmetic_pass.cpp
@@ -0,0 +1,151 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#ifdef BOOST_NO_CXX11_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
+
+int main()
+{
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ t += Duration(2);
+ BOOST_TEST(t.time_since_epoch() == Duration(5));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ t -= Duration(2);
+ BOOST_TEST(t.time_since_epoch() == Duration(1));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
+ boost::chrono::time_point<Clock, Duration2> t2 = t1 - Duration2(5);
+ BOOST_TEST(t2.time_since_epoch() == Duration2(2995));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration2> t2 = t1 - Duration2(5);
+ BOOST_CONSTEXPR_ASSERT(t2.time_since_epoch() == Duration2(2995));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
+ boost::chrono::time_point<Clock, Duration2> t2(Duration2(5));
+ BOOST_TEST( (t1 - t2) == Duration2(2995));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration2> t2(Duration2(5));
+ BOOST_CONSTEXPR_ASSERT( (t1 - t2) == Duration2(2995));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
+ boost::chrono::time_point<Clock, Duration2> t2 = t1 + Duration2(5);
+ BOOST_TEST(t2.time_since_epoch() == Duration2(3005));
+ t2 = Duration2(6) + t1;
+ BOOST_TEST(t2.time_since_epoch() == Duration2(3006));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration2> t2 = t1 + Duration2(5);
+ BOOST_CONSTEXPR_ASSERT(t2.time_since_epoch() == Duration2(3005));
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration2> t3 = Duration2(6) + t1;
+ BOOST_CONSTEXPR_ASSERT(t3.time_since_epoch() == Duration2(3006));
+ }
+#ifdef BOOST_CHRONO_EXTENSIONS
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ t += 2;
+ BOOST_TEST(t.time_since_epoch() == Duration(5));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ t++;
+ BOOST_TEST(t.time_since_epoch() == Duration(4));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ ++t;
+ BOOST_TEST(t.time_since_epoch() == Duration(4));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ t -= 2;
+ BOOST_TEST(t.time_since_epoch() == Duration(1));
+ }
+#if 0
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
+ boost::chrono::time_point<Clock, Duration2> t2 = t1 - Duration2(5);
+ BOOST_TEST(t2.time_since_epoch() == Duration2(2995));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
+ boost::chrono::time_point<Clock, Duration2> t2(Duration2(5));
+ BOOST_TEST((t1 - t2) == Duration2(2995));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
+ boost::chrono::time_point<Clock, Duration2> t2 = t1 + Duration2(5);
+ BOOST_TEST(t2.time_since_epoch() == Duration2(3005));
+ t2 = Duration2(6) + t1;
+ BOOST_TEST(t2.time_since_epoch() == Duration2(3006));
+ }
+#endif
+#endif
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/chrono/test/time_point/comparisons/equal_fail.cpp b/src/boost/libs/chrono/test/time_point/comparisons/equal_fail.cpp
new file mode 100644
index 000000000..39327377c
--- /dev/null
+++ b/src/boost/libs/chrono/test/time_point/comparisons/equal_fail.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// time_points with different clocks should not compare
+
+#include <boost/chrono/chrono.hpp>
+
+#include "../../clock.h"
+
+void test()
+{
+ typedef boost::chrono::system_clock Clock1;
+ typedef Clock Clock2;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ typedef boost::chrono::time_point<Clock1, Duration1> T1;
+ typedef boost::chrono::time_point<Clock2, Duration2> T2;
+
+ T1 t1(Duration1(3));
+ T2 t2(Duration2(3000));
+ t1 == t2;
+}
diff --git a/src/boost/libs/chrono/test/time_point/comparisons/less_fail.cpp b/src/boost/libs/chrono/test/time_point/comparisons/less_fail.cpp
new file mode 100644
index 000000000..de88234fd
--- /dev/null
+++ b/src/boost/libs/chrono/test/time_point/comparisons/less_fail.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// time_points with different clocks should not compare
+
+#include <boost/chrono/chrono.hpp>
+
+#include "../../clock.h"
+
+void test()
+{
+ typedef boost::chrono::system_clock Clock1;
+ typedef Clock Clock2;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ typedef boost::chrono::time_point<Clock1, Duration1> T1;
+ typedef boost::chrono::time_point<Clock2, Duration2> T2;
+
+ T1 t1(Duration1(3));
+ T2 t2(Duration2(3000));
+ t1 < t2;
+}
diff --git a/src/boost/libs/chrono/test/time_point/comparisons_pass.cpp b/src/boost/libs/chrono/test/time_point/comparisons_pass.cpp
new file mode 100644
index 000000000..b361c9791
--- /dev/null
+++ b/src/boost/libs/chrono/test/time_point/comparisons_pass.cpp
@@ -0,0 +1,146 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#ifdef BOOST_NO_CXX11_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
+
+
+int main()
+{
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ typedef boost::chrono::time_point<Clock, Duration1> T1;
+ typedef boost::chrono::time_point<Clock, Duration2> T2;
+
+ {
+ T1 t1(Duration1(3));
+ T1 t2(Duration1(3));
+ BOOST_TEST( (t1 == t2));
+ BOOST_TEST(! (t1 != t2));
+ }
+ {
+ BOOST_CONSTEXPR T1 t1(Duration1(3));
+ BOOST_CONSTEXPR T1 t2(Duration1(3));
+ BOOST_CONSTEXPR_ASSERT( (t1 == t2));
+ BOOST_CONSTEXPR_ASSERT(! (t1 != t2));
+ }
+ {
+ T1 t1(Duration1(3));
+ T1 t2(Duration1(4));
+ BOOST_TEST(! (t1 == t2));
+ BOOST_TEST( (t1 != t2));
+ }
+ {
+ BOOST_CONSTEXPR T1 t1(Duration1(3));
+ BOOST_CONSTEXPR T1 t2(Duration1(4));
+ BOOST_CONSTEXPR_ASSERT(! (t1 == t2));
+ BOOST_CONSTEXPR_ASSERT( (t1 != t2));
+ }
+ {
+ T1 t1(Duration1(3));
+ T2 t2(Duration2(3000));
+ BOOST_TEST( (t1 == t2));
+ BOOST_TEST(! (t1 != t2));
+ }
+ {
+ BOOST_CONSTEXPR T1 t1(Duration1(3));
+ BOOST_CONSTEXPR T2 t2(Duration2(3000));
+ BOOST_CONSTEXPR_ASSERT( (t1 == t2));
+ BOOST_CONSTEXPR_ASSERT(! (t1 != t2));
+ }
+ {
+ T1 t1(Duration1(3));
+ T2 t2(Duration2(3001));
+ BOOST_TEST(! (t1 == t2));
+ BOOST_TEST( (t1 != t2));
+ }
+ {
+ BOOST_CONSTEXPR T1 t1(Duration1(3));
+ BOOST_CONSTEXPR T2 t2(Duration2(3001));
+ BOOST_CONSTEXPR_ASSERT(! (t1 == t2));
+ BOOST_CONSTEXPR_ASSERT( (t1 != t2));
+ }
+ {
+ T1 t1(Duration1(3));
+ T1 t2(Duration1(3));
+ BOOST_TEST(! (t1 < t2));
+ BOOST_TEST(! (t1 > t2));
+ BOOST_TEST( (t1 <= t2));
+ BOOST_TEST( (t1 >= t2));
+ }
+ {
+ BOOST_CONSTEXPR T1 t1(Duration1(3));
+ BOOST_CONSTEXPR T1 t2(Duration1(3));
+ BOOST_CONSTEXPR_ASSERT(! (t1 < t2));
+ BOOST_CONSTEXPR_ASSERT(! (t1 > t2));
+ BOOST_CONSTEXPR_ASSERT( (t1 <= t2));
+ BOOST_CONSTEXPR_ASSERT( (t1 >= t2));
+ }
+ {
+ T1 t1(Duration1(3));
+ T1 t2(Duration1(4));
+ BOOST_TEST( (t1 < t2));
+ BOOST_TEST(! (t1 > t2));
+ BOOST_TEST( (t1 <= t2));
+ BOOST_TEST(! (t1 >= t2));
+ }
+ {
+ BOOST_CONSTEXPR T1 t1(Duration1(3));
+ BOOST_CONSTEXPR T1 t2(Duration1(4));
+ BOOST_CONSTEXPR_ASSERT( (t1 < t2));
+ BOOST_CONSTEXPR_ASSERT(! (t1 > t2));
+ BOOST_CONSTEXPR_ASSERT( (t1 <= t2));
+ BOOST_CONSTEXPR_ASSERT(! (t1 >= t2));
+ }
+ {
+ T1 t1(Duration1(3));
+ T2 t2(Duration2(3000));
+ BOOST_TEST(! (t1 < t2));
+ BOOST_TEST(! (t1 > t2));
+ BOOST_TEST( (t1 <= t2));
+ BOOST_TEST( (t1 >= t2));
+ }
+ {
+ BOOST_CONSTEXPR T1 t1(Duration1(3));
+ BOOST_CONSTEXPR T2 t2(Duration2(3000));
+ BOOST_CONSTEXPR_ASSERT(! (t1 < t2));
+ BOOST_CONSTEXPR_ASSERT(! (t1 > t2));
+ BOOST_CONSTEXPR_ASSERT( (t1 <= t2));
+ BOOST_CONSTEXPR_ASSERT( (t1 >= t2));
+ }
+ {
+ T1 t1(Duration1(3));
+ T2 t2(Duration2(3001));
+ BOOST_TEST( (t1 < t2));
+ BOOST_TEST(! (t1 > t2));
+ BOOST_TEST( (t1 <= t2));
+ BOOST_TEST(! (t1 >= t2));
+ }
+ {
+ BOOST_CONSTEXPR T1 t1(Duration1(3));
+ BOOST_CONSTEXPR T2 t2(Duration2(3001));
+ BOOST_CONSTEXPR_ASSERT( (t1 < t2));
+ BOOST_CONSTEXPR_ASSERT(! (t1 > t2));
+ BOOST_CONSTEXPR_ASSERT( (t1 <= t2));
+ BOOST_CONSTEXPR_ASSERT(! (t1 >= t2));
+ }
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/chrono/test/time_point/cons/implicit_fail.cpp b/src/boost/libs/chrono/test/time_point/cons/implicit_fail.cpp
new file mode 100644
index 000000000..616ca7e11
--- /dev/null
+++ b/src/boost/libs/chrono/test/time_point/cons/implicit_fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// test for explicit
+
+#include <boost/chrono/chrono.hpp>
+
+void test()
+{
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t = Duration(3);
+}
diff --git a/src/boost/libs/chrono/test/time_point/cons/non_implicit_convertible_duration_fail.cpp b/src/boost/libs/chrono/test/time_point/cons/non_implicit_convertible_duration_fail.cpp
new file mode 100644
index 000000000..520ca4d73
--- /dev/null
+++ b/src/boost/libs/chrono/test/time_point/cons/non_implicit_convertible_duration_fail.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Duration2 shall be implicitly convertible to duration.
+
+#include <boost/chrono/chrono.hpp>
+
+void test()
+{
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ {
+ boost::chrono::time_point<Clock, Duration2> t2(Duration2(3));
+ boost::chrono::time_point<Clock, Duration1> t1 = t2;
+ }
+}
diff --git a/src/boost/libs/chrono/test/time_point/constructor_pass.cpp b/src/boost/libs/chrono/test/time_point/constructor_pass.cpp
new file mode 100644
index 000000000..62a6ed6bc
--- /dev/null
+++ b/src/boost/libs/chrono/test/time_point/constructor_pass.cpp
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include "../rep.h"
+#ifdef BOOST_NO_CXX11_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
+
+int main()
+{
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::microseconds Duration1;
+ typedef boost::chrono::milliseconds Duration2;
+ boost::chrono::time_point<Clock, Duration2> t2(Duration2(3));
+ boost::chrono::time_point<Clock, Duration1> t1 = t2;
+ BOOST_TEST(t1.time_since_epoch() == Duration1(3000));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::microseconds Duration1;
+ typedef boost::chrono::milliseconds Duration2;
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration2> t2(Duration2(3));
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration1> t1 = t2;
+ BOOST_CONSTEXPR_ASSERT(t1.time_since_epoch() == Duration1(3000));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::duration<Rep, boost::milli> Duration;
+ boost::chrono::time_point<Clock, Duration> t;
+ BOOST_TEST(t.time_since_epoch() == Duration::zero());
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::duration<Rep, boost::milli> Duration;
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration> t;
+ BOOST_CONSTEXPR_ASSERT(t.time_since_epoch() == Duration::zero());
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ BOOST_TEST(t.time_since_epoch() == Duration(3));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ BOOST_CONSTEXPR_ASSERT(t.time_since_epoch() == Duration(3));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(boost::chrono::seconds(3));
+ BOOST_TEST(t.time_since_epoch() == Duration(3000));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration> t(boost::chrono::seconds(3));
+ BOOST_CONSTEXPR_ASSERT(t.time_since_epoch() == Duration(3000));
+ }
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/chrono/test/time_point/default_duration.pass.cpp b/src/boost/libs/chrono/test/time_point/default_duration.pass.cpp
new file mode 100644
index 000000000..f816b28fc
--- /dev/null
+++ b/src/boost/libs/chrono/test/time_point/default_duration.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/type_traits.hpp>
+#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+void test()
+{
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<boost::chrono::system_clock::duration,
+ boost::chrono::time_point<boost::chrono::system_clock>::duration>::value), NOTHING, ());
+}
diff --git a/src/boost/libs/chrono/test/time_point/default_duration_pass.cpp b/src/boost/libs/chrono/test/time_point/default_duration_pass.cpp
new file mode 100644
index 000000000..f816b28fc
--- /dev/null
+++ b/src/boost/libs/chrono/test/time_point/default_duration_pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/type_traits.hpp>
+#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+void test()
+{
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<boost::chrono::system_clock::duration,
+ boost::chrono::time_point<boost::chrono::system_clock>::duration>::value), NOTHING, ());
+}
diff --git a/src/boost/libs/chrono/test/time_point/duration.fail.cpp b/src/boost/libs/chrono/test/time_point/duration.fail.cpp
new file mode 100644
index 000000000..b48f48e44
--- /dev/null
+++ b/src/boost/libs/chrono/test/time_point/duration.fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Duration shall be an instance of duration.
+
+#include <boost/chrono/chrono.hpp>
+
+void test()
+{
+ typedef boost::chrono::time_point<boost::chrono::system_clock, int> T;
+ T t;
+}
diff --git a/src/boost/libs/chrono/test/time_point/min_max_pass.cpp b/src/boost/libs/chrono/test/time_point/min_max_pass.cpp
new file mode 100644
index 000000000..74926bddf
--- /dev/null
+++ b/src/boost/libs/chrono/test/time_point/min_max_pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#if defined BOOST_NO_CXX11_NUMERIC_LIMITS || defined BOOST_NO_CXX11_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
+
+int main()
+{
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ typedef boost::chrono::time_point<Clock, Duration> TP;
+
+ BOOST_CONSTEXPR_ASSERT((TP::min)() == TP((Duration::min)()));
+ BOOST_CONSTEXPR_ASSERT((TP::max)() == TP((Duration::max)()));
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/chrono/test/time_point/not_duration_fail.cpp b/src/boost/libs/chrono/test/time_point/not_duration_fail.cpp
new file mode 100644
index 000000000..b48f48e44
--- /dev/null
+++ b/src/boost/libs/chrono/test/time_point/not_duration_fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Duration shall be an instance of duration.
+
+#include <boost/chrono/chrono.hpp>
+
+void test()
+{
+ typedef boost::chrono::time_point<boost::chrono::system_clock, int> T;
+ T t;
+}
diff --git a/src/boost/libs/chrono/test/time_point/time_point_cast_int_fail.cpp b/src/boost/libs/chrono/test/time_point/time_point_cast_int_fail.cpp
new file mode 100644
index 000000000..bf16f9a2a
--- /dev/null
+++ b/src/boost/libs/chrono/test/time_point/time_point_cast_int_fail.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// ToDuration shall be an instantiation of duration.
+
+#include <boost/chrono/chrono.hpp>
+
+void test()
+{
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::time_point<Clock, boost::chrono::milliseconds> FromTimePoint;
+ typedef boost::chrono::time_point<Clock, boost::chrono::minutes> ToTimePoint;
+ boost::chrono::time_point_cast<ToTimePoint>(FromTimePoint(boost::chrono::milliseconds(3)));
+}
diff --git a/src/boost/libs/chrono/test/time_point/time_point_cast_pass.cpp b/src/boost/libs/chrono/test/time_point/time_point_cast_pass.cpp
new file mode 100644
index 000000000..133f94c8b
--- /dev/null
+++ b/src/boost/libs/chrono/test/time_point/time_point_cast_pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/type_traits.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+#ifdef BOOST_NO_CXX11_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
+
+template <class FromDuration, class ToDuration>
+void
+test(const FromDuration& df, const ToDuration& d)
+{
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::time_point<Clock, FromDuration> FromTimePoint;
+ typedef boost::chrono::time_point<Clock, ToDuration> ToTimePoint;
+ FromTimePoint f(df);
+ ToTimePoint t(d);
+//~ #if defined(BOOST_NO_CXX11_DECLTYPE)
+ //~ typedef BOOST_TYPEOF_TPL(boost::chrono::time_point_cast<ToDuration>(f)) R;
+//~ #else
+ //~ typedef decltype(boost::chrono::time_point_cast<ToDuration>(f)) R;
+//~ #endif
+ //~ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<R, ToTimePoint>::value), NOTHING, ());
+ BOOST_TEST(boost::chrono::time_point_cast<ToDuration>(f) == t);
+}
+
+int main()
+{
+ test(boost::chrono::milliseconds(7265000), boost::chrono::hours(2));
+ test(boost::chrono::milliseconds(7265000), boost::chrono::minutes(121));
+ test(boost::chrono::milliseconds(7265000), boost::chrono::seconds(7265));
+ test(boost::chrono::milliseconds(7265000), boost::chrono::milliseconds(7265000));
+ test(boost::chrono::milliseconds(7265000), boost::chrono::microseconds(7265000000LL));
+ test(boost::chrono::milliseconds(7265000), boost::chrono::nanoseconds(7265000000000LL));
+ test(boost::chrono::milliseconds(7265000),
+ boost::chrono::duration<double, boost::ratio<3600> >(7265./3600));
+ test(boost::chrono::duration<int, boost::ratio<2, 3> >(9),
+ boost::chrono::duration<int, boost::ratio<3, 5> >(10));
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::time_point<Clock, boost::chrono::milliseconds> FromTimePoint;
+ typedef boost::chrono::time_point<Clock, boost::chrono::hours> ToTimePoint;
+ BOOST_CONSTEXPR FromTimePoint f(boost::chrono::milliseconds(7265000));
+ BOOST_CONSTEXPR ToTimePoint tph = boost::chrono::time_point_cast<boost::chrono::hours>(f);
+ BOOST_CONSTEXPR_ASSERT(tph.time_since_epoch().count() == 2);
+ }
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/chrono/test/traits/common_type_duration_pass.cpp b/src/boost/libs/chrono/test/traits/common_type_duration_pass.cpp
new file mode 100644
index 000000000..f976635ef
--- /dev/null
+++ b/src/boost/libs/chrono/test/traits/common_type_duration_pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+template <class D1, class D2, class De>
+void
+test()
+{
+ typedef typename boost::common_type<D1, D2>::type Dc;
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<Dc, De>::value), NOTHING, (D1, D2, Dc, De));
+}
+
+void testall()
+{
+ test<boost::chrono::duration<int, boost::ratio<1, 100> >,
+ boost::chrono::duration<long, boost::ratio<1, 1000> >,
+ boost::chrono::duration<long, boost::ratio<1, 1000> > >();
+ test<boost::chrono::duration<long, boost::ratio<1, 100> >,
+ boost::chrono::duration<int, boost::ratio<1, 1000> >,
+ boost::chrono::duration<long, boost::ratio<1, 1000> > >();
+ test<boost::chrono::duration<char, boost::ratio<1, 30> >,
+ boost::chrono::duration<short, boost::ratio<1, 1000> >,
+ boost::chrono::duration<int, boost::ratio<1, 3000> > >();
+ test<boost::chrono::duration<double, boost::ratio<21, 1> >,
+ boost::chrono::duration<short, boost::ratio<15, 1> >,
+ boost::chrono::duration<double, boost::ratio<3, 1> > >();
+}
diff --git a/src/boost/libs/chrono/test/traits/common_type_time_point_pass.cpp b/src/boost/libs/chrono/test/traits/common_type_time_point_pass.cpp
new file mode 100644
index 000000000..047f7ff05
--- /dev/null
+++ b/src/boost/libs/chrono/test/traits/common_type_time_point_pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/type_traits.hpp>
+
+#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+template <class D1, class D2, class De>
+void
+test()
+{
+ typedef boost::chrono::system_clock C;
+ typedef boost::chrono::time_point<C, D1> T1;
+ typedef boost::chrono::time_point<C, D2> T2;
+ typedef boost::chrono::time_point<C, De> Te;
+ typedef typename boost::common_type<T1, T2>::type Tc;
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<Tc, Te>::value), NOTHING, (T1, T2, Tc, Te));
+}
+
+void testall()
+{
+ test<boost::chrono::duration<int, boost::ratio<1, 100> >,
+ boost::chrono::duration<long, boost::ratio<1, 1000> >,
+ boost::chrono::duration<long, boost::ratio<1, 1000> > >();
+ test<boost::chrono::duration<long, boost::ratio<1, 100> >,
+ boost::chrono::duration<int, boost::ratio<1, 1000> >,
+ boost::chrono::duration<long, boost::ratio<1, 1000> > >();
+ test<boost::chrono::duration<char, boost::ratio<1, 30> >,
+ boost::chrono::duration<short, boost::ratio<1, 1000> >,
+ boost::chrono::duration<int, boost::ratio<1, 3000> > >();
+ test<boost::chrono::duration<double, boost::ratio<21, 1> >,
+ boost::chrono::duration<short, boost::ratio<15, 1> >,
+ boost::chrono::duration<double, boost::ratio<3, 1> > >();
+}
diff --git a/src/boost/libs/chrono/test/traits/duration_values_pass.cpp b/src/boost/libs/chrono/test/traits/duration_values_pass.cpp
new file mode 100644
index 000000000..9d2c07938
--- /dev/null
+++ b/src/boost/libs/chrono/test/traits/duration_values_pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/type_traits.hpp>
+#include <limits>
+#include <boost/detail/lightweight_test.hpp>
+
+#include "../rep.h"
+
+int main()
+{
+ BOOST_TEST((boost::chrono::duration_values<int>::min)() ==
+ (std::numeric_limits<int>::min)());
+ BOOST_TEST((boost::chrono::duration_values<double>::min)() ==
+ -(std::numeric_limits<double>::max)());
+ BOOST_TEST((boost::chrono::duration_values<Rep>::min)() ==
+ (std::numeric_limits<Rep>::min)());
+
+ BOOST_TEST((boost::chrono::duration_values<int>::max)() ==
+ (std::numeric_limits<int>::max)());
+ BOOST_TEST((boost::chrono::duration_values<double>::max)() ==
+ (std::numeric_limits<double>::max)());
+ BOOST_TEST((boost::chrono::duration_values<Rep>::max)() ==
+ (std::numeric_limits<Rep>::max)());
+
+ BOOST_TEST(boost::chrono::duration_values<int>::zero() == 0);
+ BOOST_TEST(boost::chrono::duration_values<Rep>::zero() == 0);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/chrono/test/traits/treat_as_floating_point_pass.cpp b/src/boost/libs/chrono/test/traits/treat_as_floating_point_pass.cpp
new file mode 100644
index 000000000..6acd8ed74
--- /dev/null
+++ b/src/boost/libs/chrono/test/traits/treat_as_floating_point_pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Adaptation to Boost of the libcxx
+// Copyright 2010 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/type_traits.hpp>
+
+#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+template <class T>
+void
+test()
+{
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_base_of<boost::is_floating_point<T>,
+ boost::chrono::treat_as_floating_point<T> >::value), NOTHING, ());
+}
+
+struct A {};
+
+void testall()
+{
+ test<int>();
+ test<unsigned>();
+ test<char>();
+ test<bool>();
+ test<float>();
+ test<double>();
+ test<long double>();
+ test<A>();
+}
diff --git a/src/boost/libs/chrono/test/win32_test.cpp b/src/boost/libs/chrono/test/win32_test.cpp
new file mode 100644
index 000000000..8790f69fb
--- /dev/null
+++ b/src/boost/libs/chrono/test/win32_test.cpp
@@ -0,0 +1,149 @@
+// boost win32_test.cpp -----------------------------------------------------//
+
+// Copyright 2010 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// See http://www.boost.org/libs/chrono for documentation.
+#include <boost/chrono/config.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#if defined(BOOST_CHRONO_WINDOWS_API) || defined(__CYGWIN__)
+
+#include <boost/chrono/detail/static_assert.hpp>
+#if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+#include <boost/type_traits.hpp>
+#include <boost/typeof/typeof.hpp>
+#undef BOOST_USE_WINDOWS_H
+#include <boost/winapi/basic_types.hpp>
+#include <boost/winapi/time.hpp>
+#include <windows.h>
+
+void test() {
+ {
+ boost::winapi::LARGE_INTEGER_ a;
+ LARGE_INTEGER b;
+ BOOST_CHRONO_STATIC_ASSERT((
+ sizeof(boost::winapi::LARGE_INTEGER_)==sizeof(LARGE_INTEGER)
+ ), NOTHING, (boost::winapi::LARGE_INTEGER_, LARGE_INTEGER));
+ BOOST_TEST((
+ sizeof(a.QuadPart)==sizeof(b.QuadPart)
+ ));
+ BOOST_CHRONO_STATIC_ASSERT((
+ offsetof(boost::winapi::LARGE_INTEGER_, QuadPart)==offsetof(LARGE_INTEGER, QuadPart)
+ ), NOTHING, (boost::winapi::LARGE_INTEGER_, LARGE_INTEGER));
+ BOOST_CHRONO_STATIC_ASSERT((
+ boost::is_same<
+ BOOST_TYPEOF(a.QuadPart),
+ BOOST_TYPEOF(b.QuadPart)
+ >::value
+ ), NOTHING, (boost::winapi::LARGE_INTEGER_, LARGE_INTEGER));
+ }
+
+ BOOST_CHRONO_STATIC_ASSERT((
+ sizeof(boost::winapi::BOOL_)==sizeof(BOOL)
+ ), NOTHING, (boost::winapi::BOOL_, BOOL));
+ BOOST_CHRONO_STATIC_ASSERT((
+ boost::is_same<boost::winapi::BOOL_,BOOL>::value
+ ), NOTHING, (boost::winapi::BOOL_, BOOL));
+
+ BOOST_CHRONO_STATIC_ASSERT((
+ sizeof(boost::winapi::DWORD_)==sizeof(DWORD)
+ ), NOTHING, (boost::winapi::DWORD_, DWORD));
+ BOOST_CHRONO_STATIC_ASSERT((
+ boost::is_same<boost::winapi::DWORD_,DWORD>::value
+ ), NOTHING, (boost::winapi::DWORD_, DWORD));
+
+ BOOST_CHRONO_STATIC_ASSERT((
+ sizeof(boost::winapi::HANDLE_)==sizeof(HANDLE)
+ ), NOTHING, (boost::winapi::HANDLE_, HANDLE));
+ BOOST_CHRONO_STATIC_ASSERT((
+ boost::is_same<boost::winapi::HANDLE_,HANDLE>::value
+ ), NOTHING, (boost::winapi::HANDLE_, HANDLE));
+
+ BOOST_CHRONO_STATIC_ASSERT((
+ sizeof(boost::winapi::LONG_)==sizeof(LONG)
+ ), NOTHING, (boost::winapi::LONG_, LONG));
+ BOOST_CHRONO_STATIC_ASSERT((
+ boost::is_same<boost::winapi::LONG_,LONG>::value
+ ), NOTHING, (boost::winapi::LONG_, LONG));
+
+ BOOST_CHRONO_STATIC_ASSERT((
+ sizeof(boost::winapi::LONGLONG_)==sizeof(LONGLONG)
+ ), NOTHING, (boost::winapi::LONGLONG_, LONGLONG));
+ BOOST_CHRONO_STATIC_ASSERT((
+ boost::is_same<boost::winapi::LONGLONG_,LONGLONG>::value
+ ), NOTHING, (boost::winapi::LONGLONG_, LONGLONG));
+
+ BOOST_CHRONO_STATIC_ASSERT((
+ sizeof(boost::winapi::ULONG_PTR_)==sizeof(ULONG_PTR)
+ ), NOTHING, (boost::winapi::ULONG_PTR_, ULONG_PTR));
+ BOOST_CHRONO_STATIC_ASSERT((
+ boost::is_same<boost::winapi::ULONG_PTR_,ULONG_PTR>::value
+ ), NOTHING, (boost::winapi::ULONG_PTR_, ULONG_PTR));
+
+ BOOST_CHRONO_STATIC_ASSERT((
+ sizeof(boost::winapi::PLARGE_INTEGER_)==sizeof(PLARGE_INTEGER)
+ ), NOTHING, (boost::winapi::PLARGE_INTEGER_, PLARGE_INTEGER));
+ //~ BOOST_CHRONO_STATIC_ASSERT((
+ //~ boost::is_same<boost::winapi::PLARGE_INTEGER_,PLARGE_INTEGER>::value
+ //~ ), NOTHING, (boost::winapi::PLARGE_INTEGER_, PLARGE_INTEGER));
+
+ {
+ BOOST_CHRONO_STATIC_ASSERT((
+ sizeof(boost::winapi::FILETIME_)==sizeof(FILETIME)
+ ), NOTHING, (boost::winapi::FILETIME_, FILETIME));
+
+ BOOST_CHRONO_STATIC_ASSERT((
+ sizeof(boost::winapi::PFILETIME_)==sizeof(PFILETIME)
+ ), NOTHING, (boost::winapi::PFILETIME_, PFILETIME));
+
+
+ boost::winapi::FILETIME_ a;
+ FILETIME b;
+ BOOST_TEST((
+ sizeof(a.dwLowDateTime)==sizeof(b.dwLowDateTime)
+ ));
+ BOOST_TEST((
+ sizeof(a.dwHighDateTime)==sizeof(b.dwHighDateTime)
+ ));
+ BOOST_CHRONO_STATIC_ASSERT((
+ offsetof(boost::winapi::FILETIME_, dwLowDateTime)==offsetof(FILETIME, dwLowDateTime)
+ ), NOTHING, (boost::winapi::FILETIME_, FILETIME));
+ BOOST_CHRONO_STATIC_ASSERT((
+ offsetof(boost::winapi::FILETIME_, dwHighDateTime)==offsetof(FILETIME, dwHighDateTime)
+ ), NOTHING, (boost::winapi::FILETIME_, FILETIME));
+ BOOST_CHRONO_STATIC_ASSERT((
+ boost::is_same<
+ BOOST_TYPEOF(a.dwLowDateTime),
+ BOOST_TYPEOF(b.dwLowDateTime)
+ >::value
+ ), NOTHING, (boost::winapi::FILETIME_, FILETIME));
+ BOOST_CHRONO_STATIC_ASSERT((
+ boost::is_same<
+ BOOST_TYPEOF(a.dwHighDateTime),
+ BOOST_TYPEOF(b.dwHighDateTime)
+ >::value
+ ), NOTHING, (boost::winapi::FILETIME_, FILETIME));
+
+ }
+
+// BOOST_CHRONO_STATIC_ASSERT((
+// GetLastError==boost::winapi::::GetLastError
+// ), NOTHING, ());
+
+}
+#else
+void test() {
+}
+#endif
+int main( )
+{
+ test();
+
+ return boost::report_errors();
+}
+