Reputation: 105
I am implementing system call that will return the current time of the day (for learning purpose). I have looked at implementations of gettimeofday() on Linux 3.19.2 from the books I checked I got that The current time of day (the wall time) is defined in kernel/time/timekeeping.c:
struct timespec xtime;
[Linux kernel development Rober Love]
however I couldn't able to get the xtime variable definition in that file.
where is the xtime variable declared in the Linux kernel and how can I access it from my module or my function? what are the headers I should include?
Upvotes: 3
Views: 1330
Reputation: 12357
That reference is obsolete. Recent kernels no longer have xtime
. Though there are still some fields in the kernel timekeeping structure with a prefix of xtime_
that I assume are descended from it. See, for example, struct timekeeper
in include/linux/timekeeper_internal.h
.
You would probably want to stick to the slightly more stable functions defined in include/linux/timekeeping.h
Upvotes: 6