From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12298 invoked by alias); 29 Aug 2018 13:50:20 -0000 Mailing-List: contact newlib-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-cvs-owner@sourceware.org Received: (qmail 12246 invoked by uid 9078); 29 Aug 2018 13:50:20 -0000 Date: Wed, 29 Aug 2018 13:50:00 -0000 Message-ID: <20180829135020.12244.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] RISC-V: Fixed return code in _times syscall. X-Act-Checkin: newlib-cygwin X-Git-Author: Denis Ivanov X-Git-Refname: refs/heads/master X-Git-Oldrev: 03cd2c4efa191c2855591e23fec1e240460a0048 X-Git-Newrev: 258996b696acc2efda5cc10390d373660157b22c X-SW-Source: 2018-q3/txt/msg00100.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=258996b696acc2efda5cc10390d373660157b22c commit 258996b696acc2efda5cc10390d373660157b22c Author: Denis Ivanov Date: Fri Jul 6 12:03:15 2018 +0300 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 Diff: --- libgloss/riscv/sys_times.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgloss/riscv/sys_times.c b/libgloss/riscv/sys_times.c index eb0ef9d..fc8133a 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; }