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/main] RISC-V: Fix timeval conversion in _gettimeofday()
Date: Wed, 29 Nov 2023 09:15:12 +0000 (GMT)	[thread overview]
Message-ID: <20231129091512.19AC23858C52@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5f15d7c5817b07a6b18cbab17342c95cb7b42be4

commit 5f15d7c5817b07a6b18cbab17342c95cb7b42be4
Author:     Kuan-Wei Chiu <visitorckw@gmail.com>
AuthorDate: Wed Nov 29 11:57:14 2023 +0800
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Wed Nov 29 10:14:55 2023 +0100

    RISC-V: Fix timeval conversion in _gettimeofday()
    
    Replace multiplication with division for microseconds calculation from
    nanoseconds in _gettimeofday function.
    
    Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>

Diff:
---
 libgloss/riscv/sys_gettimeofday.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libgloss/riscv/sys_gettimeofday.c b/libgloss/riscv/sys_gettimeofday.c
index 81bea8e55670..5379a89634d2 100644
--- a/libgloss/riscv/sys_gettimeofday.c
+++ b/libgloss/riscv/sys_gettimeofday.c
@@ -23,7 +23,7 @@ _gettimeofday(struct timeval *tp, void *tzp)
   int rv;
   rv = syscall_errno (SYS_clock_gettime64, 2, 0, (long)&ts64, 0, 0, 0, 0);
   tp->tv_sec = ts64.tv_sec;
-  tp->tv_usec = ts64.tv_nsec * 1000;
+  tp->tv_usec = ts64.tv_nsec / 1000;
   return rv;
 #else
   return syscall_errno (SYS_gettimeofday, 1, tp, 0, 0, 0, 0, 0);

                 reply	other threads:[~2023-11-29  9:15 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=20231129091512.19AC23858C52@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: link
Be 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).