# How to set the clock

## Wake Rider

I'm having trouble with the clock. I set it in kde, however whenever I turn my computer on, it is randomly displaying a new time. How do I set the clock at the command line so that it displays the correct time when I turn the computer on? My timezone is Auckland, New Zealand which is currently GMT +13 for daylight savings but when that goes back in a few weeks time it is GMT +12.

----------

## MarioCorleone

emerge -av1 ntpd

then 

rc-update add ntpd default

----------

## Wake Rider

 *mario18 wrote:*   

> emerge -av1 ntpd
> 
> then 
> 
> rc-update add ntpd default

 

emerge: there are no ebuilds to satisfy ntpd

----------

## bunder

emerge ntp instead... but it sounds like something else...

what is the contents of your /etc/conf.d/clock file?

----------

## Wake Rider

 *bunder wrote:*   

> emerge ntp instead... but it sounds like something else...
> 
> what is the contents of your /etc/conf.d/clock file?

 

 *Quote:*   

> /etc/conf.d/clock
> 
> # Set CLOCK to "UTC" if your system clock is set to UTC (also known as
> 
> # Greenwich Mean Time).  If your clock is set to the local time, then
> ...

 

----------

## SiberianSniper

try setting CLOCK_SYSTOHC="yes"

----------

## Wake Rider

This clock issue has caused problems with files keep reading as Warning: <insert file name here> has a modification time in the future! How do I fix those files?

----------

## SiberianSniper

 *Wake Rider wrote:*   

> This clock issue has caused problems with files keep reading as Warning: <insert file name here> has a modification time in the future! How do I fix those files?

 

If I remember right, those go away on their own after a day or so.  But you can always do it manually with "touch <filename>" and see if the problem comes back on the next boot.

----------

## Wake Rider

 *SiberianSniper wrote:*   

>  *Wake Rider wrote:*   This clock issue has caused problems with files keep reading as Warning: <insert file name here> has a modification time in the future! How do I fix those files? 
> 
> If I remember right, those go away on their own after a day or so.  But you can always do it manually with "touch <filename>" and see if the problem comes back on the next boot.

 

Thanks for the info. I think that there are far too many files to touch every single one of them so I'll just wait it out and hope they go away.

----------

## ROBO_DONUT

It might be a dead CMOS battery.

Does your computer say something to the extent of "CMOS checksum error!" during POST?

If you alter settings in your BIOS, do they revert back to the defaults during the next reboot?

If so, you'll need to replace the battery.

----------

## bunder

okay... a few things...

CLOCK="UTC"   :Arrow:   "local"

TIMEZONE="NZ"    :Arrow:   "Pacific/Auckland"

CLOCK_SYSTOHC="no"   :Arrow:   "yes"

reboot.

run "ntpdate -b nz.pool.ntp.org"

(optional) set up ntpd for future use

that should get your clock going again...

----------

## bunder

 *Wake Rider wrote:*   

> This clock issue has caused problems with files keep reading as Warning: <insert file name here> has a modification time in the future! How do I fix those files?

 

https://forums.gentoo.org/viewtopic-t-576996-highlight-modification+future.html

----------

