# Clock problem [SOLVED]

## djpenguin

I recently did an update on my system, and the clock seems to have gone a little crazy.

The BIOS clock is properly set, and the /etc/conf.d/clock and /etc/localtime files are properly set up to run the machine at local time, but the clock seems to be determined to display a time seven hours earlier than the BIOS clock.

Any ideas what might be causing this?  As far as I can tell the clock should be properly set up for local time.Last edited by djpenguin on Fri Jul 15, 2005 5:03 pm; edited 1 time in total

----------

## magic919

/etc/rc.conf ?

----------

## pem

Clock sync between BIOS and system is achieved via hwclock command. You can check if it works properly by doing:

```
hwclock -s
```

If everything's OK, check if clock service is started at boot time. It's the service in charge of that sync.

----------

## djpenguin

Well, something is definitely not right...

```
chilly-willy djpenguin # hwclock -s

chilly-willy djpenguin # hwclock   

Thu Jul 14 04:58:44 2005  -0.339955 seconds

```

It's just a shade after 12:30 PM as a write this, not a few minutes before five in the morning.  So where to I go from here?

/etc/rc.conf no longer contains any of the clock settings, or much other stuff, for that matter.  These settings have been shifted to various files in the /etc/conf.d/ directory.

----------

## magic919

If running date gives you the time you want to see, then run 

```
hwclock  --systohc
```

 to set the hardware clock to match the system.

----------

## djpenguin

```
chilly-willy djpenguin # date

Thu Jul 14 05:44:21 PDT 2005

```

Nope.  Time is still wrong.

Thanks for all the input so far...are there any more ideas on how to correct this?

----------

## magic919

If date is wrong and hardware clock is right then hwclock --hctosys.  Check with hwclock --show beforehand.

----------

## djpenguin

Tried that before...

```
chilly-willy djpenguin # hwclock --hctosys

chilly-willy djpenguin # hwclock

Thu Jul 14 05:03:15 2005  -0.191663 seconds

chilly-willy djpenguin # hwclock --hctosys --localtime

chilly-willy djpenguin # hwclock

Thu Jul 14 05:04:17 2005  -0.407399 seconds

```

It didn't seem to work.

----------

## magic919

What an odd problem.  The settings in the files you mention are UTC on mine.  But I run ntp-client and that gets me to BST as my localtime is

```
ls -la /etc/localtime

lrwxrwxrwx  1 root root 22 Jun 23 09:37 /etc/localtime -> /usr/share/zoneinfo/GB
```

I also have UTC in /etc/rc.conf even though it seems that is redundant.

Can you do

date

hwclock --show

back to back.  

And are you files showing Local rather than UTC.  And what is your timezone?

----------

## djpenguin

Done:

```
chilly-willy djpenguin # date

Thu Jul 14 10:30:37 PDT 2005

chilly-willy djpenguin # hwclock --show

Thu Jul 14 10:30:41 2005  -0.133717 seconds

```

System is configured for local time, Pacific timezone (PST8PDT from /usr/share/zoneinfo, to be exact)

----------

## magic919

So they both match now.  You just need to correct one and then run the command to sync them.

----------

## djpenguin

I'm having a bit of trouble getting the syntax right with the date --set function.  I checked the --help page and the man page, but I haven't been able to find any good examples.

Do you know where I might find one?

----------

## pem

Here's one. I want to set my current date and time. I assume it's 09:11 and we are friday the 15th of July, 2005:

```
date 071509112005
```

07: July

15: the 15th

09: the hour

11: the minute

2005: Century and year

----------

## djpenguin

Success!

```
chilly-willy djpenguin # date

Fri Jul 15 09:54:49 PDT 2005

chilly-willy djpenguin # hwclock

Fri Jul 15 09:54:55 2005  -0.772639 seconds

```

Many thanks to all!

----------

