Message ID | 20231129035714.469943-1-visitorckw@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <newlib-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9F14D3858415 for <patchwork@sourceware.org>; Wed, 29 Nov 2023 03:57:31 +0000 (GMT) X-Original-To: newlib@sourceware.org Delivered-To: newlib@sourceware.org Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id D34413858D3C for <newlib@sourceware.org>; Wed, 29 Nov 2023 03:57:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D34413858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D34413858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::431 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701230243; cv=none; b=Q1neKSdd/zKg9Z4ESBEAYtdJI9uEYygd3BnEVERgD/0eyFSznBLSssSPQHPMxHJB2WrilA/2I1ABNOvFnbEyfdw6laTJiIcfvrfKYgV0NXjsEsjX81g4WP5a/xXXdneCR+qeFxGhkfCWE9I2BX88oygEBmuVNrvwrLU4SS8QYfs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701230243; c=relaxed/simple; bh=1UbB9owLJJdRJb7XGOX7nkHN+S3P5qeyF3KAWeyYVPc=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=m3eCRh0oUqu0ztMCPCJpErqoTgThC3uTubjB660JeWqIHm/KI+JDprMn+PUrSc3KJA4Mnq7ED88wmjwTinZ2KeNbQNfIDIkCVryJsVGVVpOLUl7K4QoqHJCmiv1vJgbgWlaxrSY3NrI5Dm+1dr+KaiGqa/f5Ct5BdaxZtmPguZo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6cdd4c5680cso5778b3a.1 for <newlib@sourceware.org>; Tue, 28 Nov 2023 19:57:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701230240; x=1701835040; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6Vzqe63muE/Qc07gfpJulUMk6ggApHn5g6oYpGbOFcU=; b=fGTH8TWuJ86u68f5T6G+wwX2u6YQyLVULd+qlMKKhLNakivQUr0DFcteCWHREXpiEE FKVal20FdE+ZUYcIvx6Ql1jhY+s20vRxqIppOuHshm+3Ohjx+0FORmusz8k8YooUysay QTSVzWSml0f9sGVf7sx52pw0hbcuRXYXO6vovJnQLUlvzo9iSbGqqqg1X/GSQ3NVMV8l hMjd79EBdAyjEQ7fa1II69yUoZBRHUBvRZzgBQk3iWsC6wIMi4NxqIgIZUmK6Q0rqxpX 4nM6yDXAVygRNkGIAmRgzTZPG8mn/svOlIs4uAcDskqqo1KYPG+hO54mOjURGifDiD0e aE5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701230240; x=1701835040; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6Vzqe63muE/Qc07gfpJulUMk6ggApHn5g6oYpGbOFcU=; b=fOlnYr1h5Y16cGTtDdeUEWkSLsGpn87ZtvMVWSbp89Lih7KfXBl03buo/0Rtqn8whG BN4T8zLuBJBeTbsWJcpH4MB6H+xp2gUh0YxC870TXyjuh3eo0PpVVlSC6ADQJYQUdj7K 5ZyNQzWQ8/NDo+r8aJrLgsiqFVh+7hF3iTVFpoagFdQXzXAVPQSUKEiFHSYJLhZ18qWM l9o6/zd815tLtEDCGhdbWaq4fUb8w0+MJwMYAcwYhEVC5d/j7P3ftbS2tHFmkrgGGsiL 1Asxdzf2Yi6roxt7CXh0VCnVuJcOMJXEgXo9YC5kYdSpZjAdN1BKmRWV5SiyytYdrkXd vpHg== X-Gm-Message-State: AOJu0YxgOjKKl0KDyT96Hr2nEnICDpJNrI29hf5hGzSR3Rojp7rDDISu n2Gv551yBigmlnmP+ghlYRMKBBny6Oo= X-Google-Smtp-Source: AGHT+IHsYu5D1WCLL5Wz1Ae02IHtK7JdxDvLIkAwqTmfRMYUf7tYjqZwtIdl7kuWxD6vQ8mGFb3zqA== X-Received: by 2002:a05:6a00:9395:b0:6cb:9482:583f with SMTP id ka21-20020a056a00939500b006cb9482583fmr21047536pfb.0.1701230240205; Tue, 28 Nov 2023 19:57:20 -0800 (PST) Received: from localhost.localdomain ([140.116.154.65]) by smtp.gmail.com with ESMTPSA id x8-20020aa784c8000000b006cb7bdbc3besm10103527pfn.17.2023.11.28.19.57.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 19:57:19 -0800 (PST) From: Kuan-Wei Chiu <visitorckw@gmail.com> To: newlib@sourceware.org Cc: kito.cheng@sifive.com, Kuan-Wei Chiu <visitorckw@gmail.com> Subject: [PATCH v2] RISC-V: Fix timeval conversion in _gettimeofday() Date: Wed, 29 Nov 2023 11:57:14 +0800 Message-Id: <20231129035714.469943-1-visitorckw@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231128223739.463754-1-visitorckw@gmail.com> References: <20231128223739.463754-1-visitorckw@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Newlib mailing list <newlib.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/newlib>, <mailto:newlib-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/newlib/> List-Post: <mailto:newlib@sourceware.org> List-Help: <mailto:newlib-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/newlib>, <mailto:newlib-request@sourceware.org?subject=subscribe> Errors-To: newlib-bounces+patchwork=sourceware.org@sourceware.org |
Series |
[v2] RISC-V: Fix timeval conversion in _gettimeofday()
|
|
Commit Message
Kuan-Wei Chiu
Nov. 29, 2023, 3:57 a.m. UTC
Replace multiplication with division for microseconds calculation from
nanoseconds in _gettimeofday function.
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
---
v1 -> v2:
- Add missing Signed-off-by tag.
libgloss/riscv/sys_gettimeofday.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
LGTM, thanks for the fix, I am suppressing that we mis-scale that for such a long time! On Wed, Nov 29, 2023 at 11:57 AM Kuan-Wei Chiu <visitorckw@gmail.com> wrote: > > Replace multiplication with division for microseconds calculation from > nanoseconds in _gettimeofday function. > > Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com> > --- > v1 -> v2: > - Add missing Signed-off-by tag. > > 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 81bea8e55..5379a8963 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); > -- > 2.25.1 >
On Nov 29 11:57, Kuan-Wei Chiu wrote: > Replace multiplication with division for microseconds calculation from > nanoseconds in _gettimeofday function. > > Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com> > --- > v1 -> v2: > - Add missing Signed-off-by tag. > > 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 81bea8e55..5379a8963 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); > -- > 2.25.1 Pushed. Thanks, Corinna
diff --git a/libgloss/riscv/sys_gettimeofday.c b/libgloss/riscv/sys_gettimeofday.c index 81bea8e55..5379a8963 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);