login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
September
»
1
Re: ktime_set() does not check for nanoseconds > one second
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Thomas Gleixner
Subject:
Re: ktime_set() does not check for nanoseconds > one second
Date: Monday, September 1, 2008 - 6:06 am
On Mon, 1 Sep 2008, Matt Fleming wrote:
quoted text
> > Yeah, a check for this in ktime_set() might make sense. Currently it's > > up to the programmer to provide sane values. :) > > > > Thanks, > > > > tglx > > > > How about the attached patch?
Won't work with arbitrary numbers. i.e. >= 2* NSEC_PER_SEC. Looking at it, I'm even less convinced that it is a good idea. tglx
quoted text
> Matt > > diff --git a/include/linux/ktime.h b/include/linux/ktime.h > index ce59832..7c0ad35 100644 > --- a/include/linux/ktime.h > +++ b/include/linux/ktime.h > @@ -150,7 +150,19 @@ static inline ktime_t timeval_to_ktime(struct timeval tv) > /* Set a ktime_t variable to a value in sec/nsec representation: */ > static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) > { > - return (ktime_t) { .tv = { .sec = secs, .nsec = nsecs } }; > + ktime_t res = { .tv = { .sec = secs, .nsec = nsecs }};; > + > + /* > + * performance trick: the (u32) -NSEC gives 0x00000000Fxxxxxxx > + * so we subtract NSEC_PER_SEC and add 1 to the upper 32 bit. > + * > + * it's equivalent to: > + * tv.nsec -= NSEC_PER_SEC > + * tv.sec ++; > + */ > + if (nsecs >= NSEC_PER_SEC) > + res.tv64 += (u32)-NSEC_PER_SEC; > + return res; > } > > /** >
--
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
ktime_set() does not check for nanoseconds > one second
, Matt Fleming
, (Mon Sep 1, 3:38 am)
Re: ktime_set() does not check for nanoseconds > one second
, Thomas Gleixner
, (Mon Sep 1, 4:20 am)
Re: ktime_set() does not check for nanoseconds > one second
, Matt Fleming
, (Mon Sep 1, 4:57 am)
Re: ktime_set() does not check for nanoseconds > one second
, Thomas Gleixner
, (Mon Sep 1, 6:06 am)
Re: ktime_set() does not check for nanoseconds > one second
, Matt Fleming
, (Mon Sep 1, 6:11 am)
Re: ktime_set() does not check for nanoseconds > one second
, Thomas Gleixner
, (Mon Sep 1, 6:16 am)
Re: ktime_set() does not check for nanoseconds > one second
, Matt Fleming
, (Mon Sep 1, 6:33 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
FUJITA Tomonori
Re: [Scst-devel] Integration of SCST in the mainstream Linux kernel
Jens Axboe
Re: [BUG] Linux 2.6.25-rc2 - Regression from 2.6.24-rc1-git1 softlockup while bo...
Ingo Molnar
Re: [RFC/RFT PATCH] sched: automated per tty task groups
Josef Bacik
[PATCH] fallocate.2: add FALLOC_FL_PUNCH_HOLE flag definition
Ingo Molnar
Re: [GIT PULL] time.c - respin
git
:
Michal Sojka
[PATCHv5 1/2] filter-branch: Fix to allow replacing submodules with another content
Junio C Hamano
Re: Fwd: git status options feature suggestion
Stefan Richter
Re: [kernel.org users] [RFD] On deprecating "git-foo" for builtins
A Large Angry SCM
Re: [RFC] origin link for cherry-pick and revert
Petr Baudis
Re: PPC SHA-1 Updates in "pu"
linux-netdev
:
Arnaldo Carvalho de Melo
Re: [PATCH 06/37] dccp: Limit feature negotiation to connection setup phase
Gerrit Renker
[PATCH 1/5] dccp: Initialisation framework for feature negotiation
Ursula Braun
[patch 2/8] [PATCH] af_iucv: sync sk shutdown flag if iucv path is quiesced
Daniel Lezcano
getsockopt(TCP_DEFER_ACCEPT) value change
David Miller
Re: 2.6.27.18: bnx2/tg3: BUG: "scheduling while atomic" trying to ifenslave a seco...
git-commits-head
:
Linux Kernel Mailing List
libata: disable ATAPI AN by default
Linux Kernel Mailing List
ARM: 5905/1: ARM: Global ASID allocation on SMP
Linux Kernel Mailing List
timer: Try to survive timer callback preempt_count leak
Linux Kernel Mailing List
misc: replace remaining __FUNCTION__ with __func__
Linux Kernel Mailing List
[ARM] 5488/1: ARM errata: Invalidation of the Instruction Cache operation can fail
openbsd-misc
:
Rene Maroufi
smtpd: Aliases only work with for local alias aliases
Stephen J. Bevan
GRE over IPsec
Darrin Chandler
Re: strange output on openbsd C code
KURS ENGLESKOG JEZIKA NA 10 CD-a
AUDIO-VIZUELNA METODA UCENJA ENGLESKOG JEZIKA na 10 CD-a
Илья Шипицин
Re: any web management gui for pf ?
Colocation donated by:
Syndicate