public inbox for newlib-cvs@sourceware.org help / color / mirror / Atom feed
From: Sebastian Huber <sh@sourceware.org> To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Fix sbttons for values > 2s Date: Mon, 04 Nov 2019 06:05:00 -0000 [thread overview] Message-ID: <20191104060506.56818.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7346e14d44e0f5ad78759bafc218b4be61408527 commit 7346e14d44e0f5ad78759bafc218b4be61408527 Author: imp <imp@FreeBSD.org> Date: Sat Apr 13 04:46:35 2019 +0000 Fix sbttons for values > 2s Add test against negative times. Add code to cope with larger values properly. Discussed with: bde@ (quite some time ago, for an earlier version) Diff: --- newlib/libc/include/sys/time.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/newlib/libc/include/sys/time.h b/newlib/libc/include/sys/time.h index c760adf..103f566 100644 --- a/newlib/libc/include/sys/time.h +++ b/newlib/libc/include/sys/time.h @@ -33,7 +33,7 @@ * SUCH DAMAGE. * * @(#)time.h 8.5 (Berkeley) 5/4/95 - * $FreeBSD: head/sys/sys/time.h 340664 2018-11-20 07:11:23Z imp $ + * $FreeBSD: head/sys/sys/time.h 346176 2019-04-13 04:46:35Z imp $ */ #ifndef _SYS_TIME_H_ @@ -191,8 +191,15 @@ sbttobt(sbintime_t _sbt) static __inline int64_t sbttons(sbintime_t _sbt) { + uint64_t ns; - return ((1000000000 * _sbt) >> 32); + ns = _sbt; + if (ns >= SBT_1S) + ns = (ns >> 32) * 1000000000; + else + ns = 0; + + return (ns + (1000000000 * (_sbt & 0xffffffffu) >> 32)); } static __inline sbintime_t
reply other threads:[~2019-11-04 6:05 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=20191104060506.56818.qmail@sourceware.org \ --to=sh@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).