Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

Set Clock

SOLVED
Go to solution
Josh Owings
Frequent Advisor

Set Clock

Can anyone tell me how to set the system time in Red Hat 7.1?
Should I/Can I sync the hardware clock to this new time. If so how would I go about doing so?
4 REPLIES
Kodjo Agbenu
Honored Contributor
Solution

Re: Set Clock

Hello,

To set system date/time using command-line (as root) :

root@mycomputer# date MMDDhhmm

Where :
MM -> month (01..12)
DD -> day (01..31)
hh -> hour (00..23)
mm -> minute (00..59)


Nobody can't tell you if you should synchronize system time with hardware clock. If you were located on the Greenwitch Meridian Timezone (GMT), I would say : of course yes, you have to do os.

In any other case, I can say : it's up to you.
Some people say that you should set the hardware clock to GMT (also called UTC) and use the TIMEZONE environment variable to specify the time shift between UTC and your local meridian.
For my part, I set hardware clock directly to my local time.

To synchronize hardware clock with system clock (or vice-versa) :

root@mycomputer# hwclock --systohc

To get all options :

root@mycomputer# hwclock --help

Good luck.

Kodjo

P.S. Don't hesitate to assign points to this answer (from 1 to 10).
Learn and explain...
Josh Owings
Frequent Advisor

Re: Set Clock

That is exactly what I was looking for.
Thank you!
Bernie Vande Griend
Respected Contributor

Re: Set Clock

Tried to post this earlier, but it crashed on me.

date is great for setting time manually, but ntpd is the way to go to ensure time is always accurate.
You can also use ntpdate to sync time immediately to an ntp server at your site or on the internet.
Example: /usr/sbin/ntpdate -b -s -p 8 ntp-0.cso.uiuc.edu ns.nts.umn.edu harbor.ecn.purdue.edu
This syncs time among 3 internet NTP servers.
If you put servers like these in /etc/ntp.conf and start ntpd then your time should always be accurate.
Ye who thinks he has a lot to say, probably shouldn't.
Josh Owings
Frequent Advisor

Re: Set Clock

Unfortunately the box in question only has internal connectivity at the moment as I am short an NIC card. But, thank you for the reply.