site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Mekhala Patil writes:
Hi All,
I want to print current date and time in a kernel module. I have also tried to use gettimeofday() by including sys/time.h But still it says undeclared.
1) do we have direct functions that we could use in kernel?
2) Can get time from epoch using gettimeofday? So, how do I convert it to the current date and time string. Is there something similar to
userspace ctime in kernel?
Please suggest.
For time elapsed since the epoch, I think clock_get_calendar_microtime() from <kern/clock.h> is what you want. I have no idea how to turn that into a human readable date/time inside the kernel though. When I used it, it was to timestamp an event log buffer which was copied out to a user-level deamon, which did the printing of the time in userspace. Drew _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com