Time Conversion

When it comes to time intervals, jiffies might not be the unit of choice in the minds of most programmers. It is more conventional to think in milliseconds or microseconds for short time intervals. The kernel thus provides some auxiliary functions to convert back and forth between these units and jiffies:

<jiffies.h>

unsigned int jiffies_to_msecs(const unsigned long j);

unsigned int jiffies_to_usecs(const unsigned long j);

unsigned long msecs_to_jiffies(const unsigned int m);

unsigned long usecs_to_jiffies(const unsigned int u);

The functions are self-explanatory. However, Section 15.2.3 shows that conversion functions between jiffies and struct timeval and struct timespec, respectively, are also available.

Continue reading here: Data Structures

Was this article helpful?

0 0