Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Ivanov <denis.ivanov@cloudbear.ru>2018-07-06 12:03:15 +0300
committerCorinna Vinschen <corinna@vinschen.de>2018-08-29 16:49:00 +0300
commit258996b696acc2efda5cc10390d373660157b22c (patch)
tree4d4c371178681ad76775c41f6785ddd67db4a0fa /libgloss/riscv
parent03cd2c4efa191c2855591e23fec1e240460a0048 (diff)
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>
Diffstat (limited to 'libgloss/riscv')
-rw-r--r--libgloss/riscv/sys_times.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libgloss/riscv/sys_times.c b/libgloss/riscv/sys_times.c
index eb0ef9d1f..fc8133ade 100644
--- a/libgloss/riscv/sys_times.c
+++ b/libgloss/riscv/sys_times.c
@@ -23,7 +23,7 @@ _times(struct tms *buf)
{
// when called for the first time, initialize t0
static struct timeval t0;
- if (t0.tv_sec == 0)
+ if (t0.tv_sec == 0 && t0.tv_usec == 0)
_gettimeofday (&t0, 0);
struct timeval t;
@@ -33,5 +33,5 @@ _times(struct tms *buf)
buf->tms_utime = utime * CLOCKS_PER_SEC / 1000000;
buf->tms_stime = buf->tms_cstime = buf->tms_cutime = 0;
- return -1;
+ return buf->tms_utime;
}