Date and Time out of whack..

Ask questions regarding Gentoox, Gentoo and Linux in general in these forums and we'll do our best to help you!
Post Reply
FXRules
Newbie
Posts: 4
Joined: Thu Jun 03, 2004 2:31 am

Date and Time out of whack..

Post by FXRules »

When I load up Gentoox the date and time are off...its like a day behind...but if I go into XBMC or a dash the time is correct? Anyone else have this problem? Can I have it sync to a server on the net when it loads? How?

Thanks!
Angel of Dawn
Adept
Posts: 51
Joined: Sat Jan 10, 2004 4:25 pm
Contact:

Post by Angel of Dawn »

I have the problem that my Linuxtime is about 80minutes away from my msdash time

I dont know how to make both times exactly matching :(
nobspangle
Gentoox Guru!
Posts: 1681
Joined: Sun Sep 28, 2003 11:59 am
Location: Manchester, UK

Post by nobspangle »

this is a stange problem the way linux works is that when it loads up, it reads the time from the system clock and then keeps time itself. I would expect to see it loose or gain time over the course of a day (as much as 40 or 50 seconds) but it should always be the same as the system clock to start with.

There are two ways to sync to a server. Both require ntp so first

Code: Select all

emerge ntp


If your box is just used in linux occasionally and only needs syncing when you turn it on. Edit /etc/conf.d/ntp-client uncomment the line NTPCLIENT_OPTS="-b someserver" and change someserver to the IP address or hostname of a local ntp server from this list. Then

Code: Select all

rc-update add ntp-client default
to run the ntp client at startup. If your time seems to have drifted whilst you are using the box you can run the client manually

Code: Select all

/etc/init.d/ntp-client restart
If your box is running linux as a server and needs to be kept in sync you will have to use the full ntp server.
Edit ntp.conf to look like this.

Code: Select all

logfile         /var/log/ntpd/ntpd.log
driftfile       /var/state/ntp.drift
server ntp.server1.com
server ntp.server2.com
server ntp.server3.com
server ntp.server4.com
server 127.127.1.0
fudge 127.127.1.0 stratum 4
Replace the ntp.server.com lines with 3 or 4 servers from this list.
then add ntp to start on boot and run it

Code: Select all

rc-update add ntp default
/etc/init.d/ntp start
If you keep an open mind, will your brain fall out?
Krazy
Adept
Posts: 54
Joined: Wed Sep 10, 2003 8:41 pm
Location: Auckland, New Zealand

Post by Krazy »

Hi,

Just thought I should make the following comment:
If your box is running linux as a server...
<snipped>
then add ntp to start on boot and run it

Code: Select all

rc-update add ntp default 
/etc/init.d/ntp start
I had to type 'ntpd' instead of 'ntp' as the later didn't exist in /etc/init.d/ :(

This relates to the latest ntp version I could find via emerge today [22 Jul 05], viz:
net-misc/ntp -- Latest version available: 4.2.0.20040617-r2


BTW, for those not living in Britain, remember to set your timezone as appropriate.
Ianh
Linux User
Posts: 13
Joined: Fri Dec 29, 2006 10:56 pm

NTP and time

Post by Ianh »

I am new to this so sorry if you think I should know the answer.

The Hardware clock on my xbox is not set to the correct time/date. Although I do have a mod chip which is supposed to allow you to use the xbox bios (by pushing the eject button to power up) it doesn't want to work. I don't want to get the soldering iron out again so I'm going to put up with the wrong hardware time/date. As far as I can see (google etc) there is no way of setting the hardware time/date.

I can across this thread and I attmepted to "emerge ntp" . I got the following error message "dev-java/java-config-1.3 pacjage conflicts with another package"

Can any one help ? I have tried to unmerge the java package but I got the error message "couldn't find 'java-config-1.3' to unmerge"

Thank you

Ian
Ianh
Linux User
Posts: 13
Joined: Fri Dec 29, 2006 10:56 pm

Post by Ianh »

In case anyone else comes across the hardware time issue

http://www.linuxsa.org.au/tips/time.html

basically set the software clock using date then run

sbin/hwclock --systohc'

to sync the two clocks

IanH
Pyrite
Novice
Posts: 27
Joined: Sun Jan 07, 2007 9:42 am

Post by Pyrite »

I had this problem with the full native install. I am not using NTP.

First, set the date with the `date` command like this:

Code: Select all

date MMDDhhmmYYYY
eg.

Code: Select all

date 010822332007
for January 08 2007 at 22:33 PM

Second, set your correct timezone. Set your time zone information by copying the correct file from /usr/share/zoneinfo over the /etc/localtime file. Eg, for me, I use CST for America/Chicago.

Code: Select all

cp /usr/share/zoneinfo/America/Chicago /etc/localtime
Third, edit the /etc/conf.d/clock file like mine.

Code: Select all

CLOCK="UTC"
CLOCK_SYSTOHC="yes"
This saves the current system date/time to the hardware clock. When you reboot, it should be what you set with the date command. Hope this helps somebody.
Post Reply