tv_sec - seconds elapsed since January 1, 1970 (UTC)
tv_nsec - nanoseconds in the last second
- Manoj
On Jan 22, 2008 7:34 PM, Erik Mouw <mouw@xxxxxxxxxxxx> wrote:
On Tue, Jan 22, 2008 at 06:17:29PM +0530, Kathiresan, Lekshmanan wrote:No.
> I want to print current date and time in a kernel module.
>
> 1) do we have direct functions that we could use in kernel?
You don't. The kernel doesn't have an idea about current date and time.
> 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?
Date and time depends on timezone rules, and that's userspace. If you
need date and time of your local timezone in your kernel module, your
module is broken by design.
Erik
--
They're all fools. Don't worry. Darwin may be slow, but he'll
eventually get them. -- Matthew Lammers in alt.sysadmin.recovery
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFHlff5/PlVHJtIto0RAv8tAJ4qZXc0fWrWiFW6edrigxG7L1hpzgCbBsQW
QGoZuRnkNPoNjE144TohLeI=
=nP2q
-----END PGP SIGNATURE-----