public inbox for newlib-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] RISC-V: Fixed return code in _times syscall. Date: Wed, 29 Aug 2018 13:50:00 -0000 [thread overview] Message-ID: <20180829135020.12244.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=258996b696acc2efda5cc10390d373660157b22c commit 258996b696acc2efda5cc10390d373660157b22c Author: Denis Ivanov <denis.ivanov@cloudbear.ru> 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 <kito.cheng@gmail.com> 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; }
reply other threads:[~2018-08-29 13:50 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180829135020.12244.qmail@sourceware.org \ --to=corinna@sourceware.org \ --cc=newlib-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).