4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-19 12:59:21 +08:00

RISC-V: Fixed return code in _times syscall.

Upon successful completion, times() shall return the elapsed real time,
in clock ticks, since an arbitrary point in the past (for example,
system start-up time).

Signed-off-by: Kito Cheng <kito.cheng@gmail.com>
This commit is contained in:
Denis Ivanov 2018-07-06 12:03:15 +03:00 committed by Corinna Vinschen
parent 03cd2c4efa
commit 258996b696

View File

@ -23,7 +23,7 @@ _times(struct tms *buf)
{ {
// when called for the first time, initialize t0 // when called for the first time, initialize t0
static struct timeval t0; static struct timeval t0;
if (t0.tv_sec == 0) if (t0.tv_sec == 0 && t0.tv_usec == 0)
_gettimeofday (&t0, 0); _gettimeofday (&t0, 0);
struct timeval t; struct timeval t;
@ -33,5 +33,5 @@ _times(struct tms *buf)
buf->tms_utime = utime * CLOCKS_PER_SEC / 1000000; buf->tms_utime = utime * CLOCKS_PER_SEC / 1000000;
buf->tms_stime = buf->tms_cstime = buf->tms_cutime = 0; buf->tms_stime = buf->tms_cstime = buf->tms_cutime = 0;
return -1; return buf->tms_utime;
} }