I came across the following code in the kernel:
/* * Have the 32 bit jiffies value wrap 5 minutes after boot * so jiffies wrap bugs show up earlier. */ #define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ))static inline u32 cstamp_delta(unsigned long cstamp){ return (cstamp - INITIAL_JIFFIES) * 100UL / HZ;}
where cstamp
value is in jiffies
.
This is the code from net/ipv4/devinet.c
where IP address per interface is implemented (among other things).
I see that INITIAL_JIFFIES
macro takes the value of 5 minutes (300) and converts it in jiffies
(-300*HZ
), and typecasting ensures correct value wrapping.
But why is it explicitly set to negative value (-300*HZ
)?
I'm not sure, in what units cstamp_delta()
returns?