Sorry, your posting is 14 minutes too late ;-). I just re-invented this
wheel. Such is the pace of Linux kernel development.
> static unsigned long long jiffies_hi = 0;
> static unsigned long old_jiffies = 0;
> unsigned long jiffy_cache;
>
> /* some spinlock or inode lock or something like that */
> jiffy_cache = jiffies;
> if (jiffy_cache < old_jiffies) {
> jiffies_hi += 1ULL << BITS_PER_LONG;
> }
Ah, my code only stored the high 32 bits of the jiffies_hi, so we don't
ever do 64-bit math for this, only a simple increment. Otherwise it is
exactly the same, including the "some spinlock or something" comment ;-).
Cheers, Andreas
-- Andreas Dilger http://sourceforge.net/projects/ext2resize/ http://www-mddsp.enel.ucalgary.ca/People/adilger/- 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/