[Boost-bugs] [Boost C++ Libraries] #9146: chrono_io support for time format with fractional seconds

Subject: [Boost-bugs] [Boost C++ Libraries] #9146: chrono_io support for time format with fractional seconds
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-09-21 20:05:49


#9146: chrono_io support for time format with fractional seconds
-----------------------------------------+---------------------
 Reporter: Johan Lundberg <lundberj@…> | Owner: viboes
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: chrono
  Version: Boost 1.54.0 | Severity: Problem
 Keywords: |
-----------------------------------------+---------------------
 I propose %f and %F is added to chrono_io in analogy with
 http://www.boost.org/doc/libs/1_53_0/doc/html/date_time/date_time_io.html

 Unfortunately this is just a specification, no suggested implementation.

 Examples:
 {{{
  1970-01-01 00:02:46
  1970-01-01 00:02:46.7
  1970-01-01 00:02:46.67
  1970-01-01 00:02:46.667
 }}}
 all the way up to nanoseconds (as gnu date +%N):
 {{{
  1970-01-01 00:02:46.666666667
 }}}

 (variants with T instead of space, and time-zone are the real use-cases,
 but that aspect already works)

 Some tools write fractional seconds only if they are not zero.
 date_time_io supports that using %F so I suggest that for chrono_io as
 well.

 To support writing all of the above formats one could allow for example
 %3f (and %3F) for printing .667. Alternatively, %N for nanoseconds. When
 parsing i suggest the number of digits specified is ignored but I may be
 wrong on that.

 In addition to the above, the documentation has no list of allowed keys
 for the format strings.

 references:

 * The bug https://svn.boost.org/trac/boost/ticket/7868 was just fixed.

 * doc:
 http://www.boost.org/doc/libs/1_54_0/doc/html/chrono/users_guide.html#chrono.users_guide.getting_started.hello_world__
 :

 'Unfortunately there are no formatting/parsing sequences which indicate
 fractional seconds. Boost.Chrono does not provide such sequences. In the
 meantime, one can format and parse fractional seconds for
 system_clock::time_point by defaulting the format, or by using an empty
 string in time_fmt().'

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9146>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:14 UTC