Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 126385 - times(NULL) function returns negative value
Summary: times(NULL) function returns negative value
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-15 22:51 UTC by Christophe Boccheciampe
Modified: 2006-03-16 17:44 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Boccheciampe 2006-03-15 22:51:17 UTC
This simple program should return a positive value

-----------------------
#include <sys/times.h>
#include <iostream>

main() {
        std::cout << times(NULL) << std::endl;
}
-----------------------

Instead I get something like "-2142386810" as a result.

These values freeze some applications like Oracle-10.2.0.

Some details :
Portage 2.0.54 (default-linux/x86/2005.1, gcc-3.3.6, glibc-2.3.5-r2, 2.6.14.3 i686)
=================================================================
System uname: 2.6.14.3 i686 AMD Opteron(tm) Processor 852
Gentoo Base System version 1.6.14

- 4 CPU (AMD Opteron 852 - 2.6GHz)
- 16 GB RAM
- Uptime : about 50 days
- all updates done
- no masked packages installed

I had to reboot very quickly since it is our main students server. times(NULL) now returns a positive value (until ... ?).

Tell me if more details needed.
Comment 1 SpanKY gentoo-dev 2006-03-16 17:41:09 UTC
glibc doesnt implement times() ... it merely calls the kernel
Comment 2 SpanKY gentoo-dev 2006-03-16 17:44:52 UTC
but really i dont see this as a bug

if we review the specs on the function:
http://www.opengroup.org/onlinepubs/009695399/functions/times.html

the return value has these characteristics:
 - completely arbitrary
 - success can be any value at all except for -1
 - return value may be overflowed as long as the result isnt -1