Bug 15524

Summary: [DR#437] clock() behaves incorrectly on overflow
Product: glibc Reporter: Rich Felker <bugdal>
Component: timeAssignee: Not yet assigned to anyone <unassigned>
Status: SUSPENDED ---    
Severity: normal CC: drepper.fsp
Priority: P2 Flags: fweimer: security-
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Rich Felker 2013-05-23 20:24:04 UTC
According to the Austin Group interpretation for issue 686 (http://austingroupbugs.net/view.php?id=686), the current behavior of clock() on 32-bit systems, wrapping when it overflows the range of clock_t, is non-conforming to the requirements of ISO C, which require returning (clock_t)-1 if the result is not representable.
Comment 1 Joseph Myers 2015-08-24 11:38:17 UTC
C11 DR#437 is still open, but the currently proposed TC says the return value should be unspecified on overflow, so allowing existing widespread implementation practice.

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1931.htm#dr_437