Skip to contentSkip to conversation

time_is_after_jiffies misnomer

DISCUSSION Peter T. Breuer 2 participants 2 messages Dec 16, 2008

lore
Share & tools
lore
#0 lore raw

"Also sprach ptb:"

Quoted 6 lines

"Also sprach Johannes Weiner:"

Quoted 1 line

'foo jiffies'?

?? What does that mean? Yes, "the current time is later than foo jiffies", is what I wrote. I don't understand why you query it. What I wrote is a perfectly normal english sentence.

Light dawns. Perhaps you think "jiffies" is a meaningless word that happens to be the name of a variable that measures elapsed time.

It's not. "jiffy" is a "short moment of time" in english, and "jiffies" is its plural. Like "augenblick" in german, but a bit longer ("augenblick" probably translates as "moment", or "instant", literally, "eyeblink"). "In a jiffy" is an english phrase meaning "soon!". It's close to an "instant" but of vaguer extent.

So the variable called "jiffies" measures the number of elapsed jiffies.

Like a variable called "hours" that measures the number of elapsed hours.

"foo jiffies" is no stranger than "foo hours" or "foo minutes" or "foo seconds". That's why I was puzzled that you queried it!

Quoted 6 lines

It's poor english. Yes, to an english speaker

time_is_after_jiffies(foo)

looks like

Quoted 7 lines

the current time is later than foo jiffies

Look at the two:

the current time is later than foo jiffies

                 |   |  |           `/.
               time_is_after_jiffies(foo)

See it now?

Imagine that you had a macro called

time_is_after_hours

then

time_is_after_hours(12)

would mean to an english speaker

the current time is later than midday

I.e.

the current time is later than 12h

               |    |   |        .|'
              time_is_after_hours(12)

Unfortunately the kernel's "time_is_after_hours(12)" macro means mathematically what we would express in english as "the current time is BEFORE 12h". Ouch.

The kernel's

     time_is_after_jiffies(500)

macro mathematically means

the current value of the jiffies variable is LESS THAN 500

!! That's the other way round from the way that an english speaker would read the macro name as meaning! So the semantics and the name contradict each other.

Clear now?

Peter

#1 lore raw
Quoted 7 lines · Peter T. Breuer

The kernel's

    time_is_after_jiffies(500)

macro mathematically means

the current value of the jiffies variable is LESS THAN 500

Not that you would ever do something like that. Instead, you will see something like this if you grep the kernel sources a bit:

time_is_after_jiffies(jiffies + 500)

Pekka