|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r86492 - in branches/release: boost/chrono/io libs/chrono/doc libs/chrono/example libs/chrono/test libs/chrono/test/io
From: vicente.botet_at_[hidden]
Date: 2013-10-27 19:55:01
Author: viboes
Date: 2013-10-27 19:55:01 EDT (Sun, 27 Oct 2013)
New Revision: 86492
URL: http://svn.boost.org/trac/boost/changeset/86492
Log:
Chrono: merge timepoint io improvements.
Text files modified:
branches/release/boost/chrono/io/time_point_io.hpp | 15 +++++++++------
branches/release/libs/chrono/doc/chrono.qbk | 2 ++
branches/release/libs/chrono/example/io_ex1.cpp | 3 +++
branches/release/libs/chrono/test/Jamfile.v2 | 3 ++-
branches/release/libs/chrono/test/io/time_point_output.cpp | 3 ++-
branches/release/libs/chrono/test/test_7868.cpp | 7 +++++++
6 files changed, 25 insertions(+), 8 deletions(-)
Modified: branches/release/boost/chrono/io/time_point_io.hpp
==============================================================================
--- branches/release/boost/chrono/io/time_point_io.hpp Sun Oct 27 19:29:52 2013 (r86491)
+++ branches/release/boost/chrono/io/time_point_io.hpp 2013-10-27 19:55:01 EDT (Sun, 27 Oct 2013) (r86492)
@@ -32,17 +32,20 @@
#include <boost/detail/no_exceptions_support.hpp>
#include <cstring>
#include <locale>
-#include <string.h>
+#include <ctime>
#define BOOST_CHRONO_INTERNAL_TIMEGM \
- ( defined BOOST_WINDOWS && ! defined(__CYGWIN__) ) || \
- ( (defined(sun) || defined(__sun)) && defined __GNUC__)
-
-#define BOOST_CHRONO_INTERNAL_GMTIME defined BOOST_WINDOWS && ! defined(__CYGWIN__)
+ ( defined BOOST_WINDOWS && ! defined(__CYGWIN__) ) \
+ || ( (defined(sun) || defined(__sun)) && defined __GNUC__) \
+ || (defined __IBMCPP__)
+
+#define BOOST_CHRONO_INTERNAL_GMTIME \
+ (defined BOOST_WINDOWS && ! defined(__CYGWIN__)) \
+ || ( (defined(sun) || defined(__sun)) && defined __GNUC__) \
+ || (defined __IBMCPP__)
#define BOOST_CHRONO_USES_INTERNAL_TIME_GET
-
namespace boost
{
namespace chrono
Modified: branches/release/libs/chrono/doc/chrono.qbk
==============================================================================
--- branches/release/libs/chrono/doc/chrono.qbk Sun Oct 27 19:29:52 2013 (r86491)
+++ branches/release/libs/chrono/doc/chrono.qbk 2013-10-27 19:55:01 EDT (Sun, 27 Oct 2013) (r86492)
@@ -7371,6 +7371,8 @@
* [@http://svn.boost.org/trac/boost/ticket/7868 #7868] chrono_io parses time incorrectly (1.53 and 1.52)
* [@http://svn.boost.org/trac/boost/ticket/9028 #9028] Typo in boost/chrono/stopwatches/formatters/base_formatter.hpp
* [@http://svn.boost.org/trac/boost/ticket/9147 #9147] uninitialized std::tm
+* [@http://svn.boost.org/trac/boost/ticket/9274 #9274] lost of precission on system_clock input.
+* [@http://svn.boost.org/trac/boost/ticket/9276 #9276] output from a system_clock::time_point get a time_point that is one day later than expected.
[endsect] [/section [*Version 2.0.3] ]
Modified: branches/release/libs/chrono/example/io_ex1.cpp
==============================================================================
--- branches/release/libs/chrono/example/io_ex1.cpp Sun Oct 27 19:29:52 2013 (r86491)
+++ branches/release/libs/chrono/example/io_ex1.cpp 2013-10-27 19:55:01 EDT (Sun, 27 Oct 2013) (r86492)
@@ -53,10 +53,13 @@
<< ClockTick(3) + nanoseconds(10) << '\n';
cout << "\nsystem_clock::now() = " << system_clock::now() << '\n';
+#if defined _MSC_VER && _MSC_VER == 1700
+#else
#if BOOST_CHRONO_VERSION==2
cout << "\nsystem_clock::now() = " << time_fmt(chrono::timezone::local) << system_clock::now() << '\n';
cout << "\nsystem_clock::now() = " << time_fmt(chrono::timezone::local,"%Y/%m/%d") << system_clock::now() << '\n';
#endif
+#endif
#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
cout << "steady_clock::now() = " << steady_clock::now() << '\n';
Modified: branches/release/libs/chrono/test/Jamfile.v2
==============================================================================
--- branches/release/libs/chrono/test/Jamfile.v2 Sun Oct 27 19:29:52 2013 (r86491)
+++ branches/release/libs/chrono/test/Jamfile.v2 2013-10-27 19:55:01 EDT (Sun, 27 Oct 2013) (r86492)
@@ -110,7 +110,7 @@
: <define>BOOST_CHRONO_HEADER_ONLY
<define>BOOST_ERROR_CODE_HEADER_ONLY
#<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- <define>BOOST_CHRONO_VERSION=2
+ #<define>BOOST_CHRONO_VERSION=1
: v1_$(sources[1]:B)_h ]
;
}
@@ -473,6 +473,7 @@
[ 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 ]
;
test-suite "win32"
Modified: branches/release/libs/chrono/test/io/time_point_output.cpp
==============================================================================
--- branches/release/libs/chrono/test/io/time_point_output.cpp Sun Oct 27 19:29:52 2013 (r86491)
+++ branches/release/libs/chrono/test/io/time_point_output.cpp 2013-10-27 19:55:01 EDT (Sun, 27 Oct 2013) (r86492)
@@ -274,7 +274,8 @@
check_all<boost::chrono::process_cpu_clock> ();
#endif
-#if BOOST_CHRONO_VERSION == 2
+#if 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);
Modified: branches/release/libs/chrono/test/test_7868.cpp
==============================================================================
--- branches/release/libs/chrono/test/test_7868.cpp Sun Oct 27 19:29:52 2013 (r86491)
+++ branches/release/libs/chrono/test/test_7868.cpp 2013-10-27 19:55:01 EDT (Sun, 27 Oct 2013) (r86492)
@@ -13,6 +13,7 @@
#include <boost/chrono/round.hpp>
#include <boost/chrono/ceil.hpp>
#include <boost/detail/lightweight_test.hpp>
+#include <cstdio>
int main()
{
@@ -26,10 +27,16 @@
// 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;
+ 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:
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk