do_gettiimeofday query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am having trouble with do_gettimeofday() function. I have following
source code:

int my_module_init(void)
{
    struct timeval tv = {0};
    do_gettimeofday(&tv);
    printk("tv.tv_sec = %lu\n", tv.tv_sec);
    return 0;
}
module_init(my_module_init);

This code is built-in kernel, and therefore my_module_init is called
during device_initcall.

However the tv_sec value seems to be wrong (I was expecting this value
to be absolute number of seconds since 1970), but it prints 11 or 12
(which seems to be number of seconds since last boot).

I checked do_gettimeofday function source which gets the value from
xtime variable. I could not find who is responsible for initializing
xtime.

I tried to change module_init by late_initcall_sync. Still it's same.

Any help is appreciated.

Regards
Lal

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux