Re: system clock...

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

 



Ankit Jain a écrit :
hi

i have a problem with my system clock.

whenever i reboot or start my system my clock is
incremented by around 6 hrs. after that its alright
i.e if i correct the time it dosent mis behave but i
dont know whats wrong in reboot or booting the sys?

if somebody can help or faced this kinda situation?


Typically, it is just a problem between the hardware clock using local time and the kernel using UTC (Greenwich time) or the opposite.


You have to know that there is a hardware clock (in the BIOS) and a software clock. Windows use local time for the BIOS, while Linux normally use UTC. So, if you reboot in Windows, the time will be correct. Since Linux think that the BIOS is in UTC, it set its software clock with the time it found in the BIOS, and add (or substract) hours depending of the user time zone.

"date" set only the software time. "hwclock" is the one used at boot time to set the software clock.

  Try this as root (or pick a look at /etc/adjtime ):

hwclock --utc
hwclock --localtime

It shows the time of your BIOS, and one of them is probably good. The simpliest is to just set your software time as you did, and set the hardware clock the way you want (UTC or local time).

hwclock --utc       --systohc
hwclock --localtime --systohc

If you use Windoze, takes what works from the previous commands (probably --localtime) otherwise it is windows that will get the time wrong after the next reboot. If you use only Linux/Unix, I would prefer to use --UTC but both works.


Finally, it is also possible that your timezone is not properly adjusted in Linux (see tzset), but most people adjust it properly during Linux installation.


Simon Valiquette
http://www.gulus.org

-
: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux