Archive

Posts Tagged ‘timing’

Get current time in kernel

April 26, 2010 Leave a comment

The way to get the current time in kernel is by calling current_kernel_time() from the linux/time.h file. There is a macro called CURRENT_TIME() which just calls current_kernel_time(). It saves a few cycles to call it directly. The return type will be timespec struct type.

timespec has 2 fields – seconds and nanoseconds.

Advertisements
Categories: Linux Kernel Misc Tags: ,