Re: get current time in kernel module
Re: get current time in kernel module
- Subject: Re: get current time in kernel module
- From: Andrew Gallatin <email@hidden>
- Date: Thu, 28 Jul 2005 09:47:22 -0400 (EDT)
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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden