Title
clock error handling needs to be specified
Status
nad
Section
[time.clock]
Submitter
Beman Dawes

Created on 2008-11-24.00:00:00 last changed 78 months ago

Messages

Date: 2018-06-22.06:38:21

Proposed resolution:

Accept the proposed wording of N2828, Library Support for hybrid error handling (Rev 1).

Change Clock requirements [time.clock.req] as indicated:

-2- In Table 55 C1 and C2 denote clock types. t1 and t2 are values returned by C1::now() where the call returning t1 happens before (1.10) the call returning t2 and both of these calls happen before C1::time_point::max(). ec denotes an object of type error_code ([syserr.errcode.overview]).

Table 55 — Clock requirements
ExpressionReturn typeOperational semantics
... ... ...
C1::now() C1::time_point Returns a time_point object representing the current point in time.
C1::now(ec) C1::time_point Returns a time_point object representing the current point in time.

Change class system_clock [time.clock.system] as indicated:

static time_point now(error_code& ec=throws());

Change class monotonic_clock [time.clock.monotonic] as indicated:

static time_point now(error_code& ec=throws());

Change class high_resolution_clock [time.clock.hires] as indicated:

static time_point now(error_code& ec=throws());
Date: 2018-06-22.06:38:21

[ LEWG Kona 2017 ]

Recommend NAD. Needs a paper. Proposed resolution no longer applies.

Date: 2010-10-21.18:28:33

[ 2009-10 Santa Cruz: ]

Mark as NAD future. Too late to make this change without having already accepted the hybrid error handling proposal.

Date: 2010-10-21.18:28:33

[ Batavia (2009-05): ]

We recommend this issue be deferred until the next Committee Draft has been issued and the prerequisite paper has been accepted.

Move to Open.

Date: 2008-11-24.00:00:00

Each of the three clocks specified in Clocks [time.clock] provides the member function:

static time_point now();

The semantics specified by Clock requirements [time.clock.req] make no mention of error handling. Thus the function may throw bad_alloc or an implementation-defined exception ([res.on.exception.handling] paragraph 4).

Some implementations of these functions on POSIX, Windows, and presumably on other operating systems, may fail in ways only detectable at runtime. Some failures on Windows are due to supporting chipset errata and can even occur after successful calls to a clock's now() function.

These functions are used in cases where exceptions are not appropriate or where the specifics of the exception or cause of error need to be available to the user. See N2828, Library Support for hybrid error handling (Rev 1), for more specific discussion of use cases. Thus some change in the interface of now is required.

The proposed resolution has been implemented in the Boost version of the chrono library. No problems were encountered.

History
Date User Action Args
2018-06-22 06:38:21adminsetmessages: + msg9955
2018-06-22 06:38:21adminsetstatus: lewg -> nad
2014-11-24 15:11:58adminsetstatus: nad future -> lewg
2010-10-21 18:28:33adminsetmessages: + msg4451
2010-10-21 18:28:33adminsetmessages: + msg4450
2010-10-21 18:28:33adminsetmessages: + msg4449
2008-11-24 00:00:00admincreate