LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-27-2003, 09:25 PM   #1
h/w
Senior Member
 
Registered: Mar 2003
Location: New York, NY
Distribution: Debian Testing
Posts: 1,286

Rep: Reputation: 46
how to change the system time?


i have no clue where to look or what to do to change the clock time on my machine. lol.
i had some issues with the kernel losing too many ticks, and now my clock has gone back in time.

can anyone tell me how to change the time?
thanks.
 
Old 12-27-2003, 09:49 PM   #2
peok
Member
 
Registered: Aug 2003
Location: CA, USA
Distribution: (Almost) LFS 6.1.1
Posts: 91

Rep: Reputation: 15
I don't know either, but if I were you I might try "man -K time" or clock or something like that to find the app to change it.
 
Old 12-27-2003, 09:50 PM   #3
brew1brew
Member
 
Registered: Jul 2003
Location: Plano TX (north of Dallas)
Distribution: Kubuntu
Posts: 165

Rep: Reputation: 30
go here http://www.ntp.org/index.html. you have to configure 3 sources in the npt.conf file to make it work, but it will keep your clock set.
 
Old 12-27-2003, 10:16 PM   #4
h/w
Senior Member
 
Registered: Mar 2003
Location: New York, NY
Distribution: Debian Testing
Posts: 1,286

Original Poster
Rep: Reputation: 46
thanks for writing back you two.

peok: what is the -K option for? it gives me an invalid option when i provide that. and time/clock didnt seem too helpful.

b1b: will look into it tomorrow now.

there has GOT to be a way to do it without connecting and syncing with some server someplace. lol
 
Old 12-27-2003, 10:35 PM   #5
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
date MMDDhhmm
for example to set system time to 28th December 3:25 PM you would use:
date 12281525
Not exactly sure about Debian sid but if you set your clock to use local hardware clock, do a
hwclock systohc (some distros do it automatically at shutdown)
this will set your bios clock to your system time, therefore next time when your system boots the system will be set correctly
but keep in mind that hardware clock is inaccurate(i think it goes out of sync by few seconds every week, not exactly sure) therefore if possible you're better off syncing system time with the time server everytime it boots(or setup a cron job), then sync the system clock to hardware clock.

Last edited by Demonbane; 12-28-2003 at 02:53 AM.
 
Old 12-28-2003, 02:48 AM   #6
brew1brew
Member
 
Registered: Jul 2003
Location: Plano TX (north of Dallas)
Distribution: Kubuntu
Posts: 165

Rep: Reputation: 30
h/w the reason I said to use ntp is as Demonbane said, your hardware clock is going to lose/gain time so if you use ntp, eather ntpd or configure ntp and use "ntptimeset -s" in a cron job, you clock will always be spot on.
 
Old 12-28-2003, 12:32 PM   #7
teona
Member
 
Registered: Oct 2003
Distribution: Slackware 9.1
Posts: 64

Rep: Reputation: 15
I had a problem with time before, and changeing the time/date in the BIOS will change it in linux aswell...
 
Old 12-28-2003, 12:40 PM   #8
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally posted by teona
I had a problem with time before, and changeing the time/date in the BIOS will change it in linux aswell...
Just for anyone else's information, that's only if you have your time to be set by your hardware clock, which is in the BIOS..
 
Old 12-28-2003, 12:42 PM   #9
teona
Member
 
Registered: Oct 2003
Distribution: Slackware 9.1
Posts: 64

Rep: Reputation: 15
oh sory, yes I forgott to mention that
 
Old 12-28-2003, 01:10 PM   #10
h/w
Senior Member
 
Registered: Mar 2003
Location: New York, NY
Distribution: Debian Testing
Posts: 1,286

Original Poster
Rep: Reputation: 46
hey all - thanks for the suggestions.
after looking at the link brew provided, i booted into my win32 partition, and reset the clock (it was in the documentation there). lol.
i'll look at doing it the ntp way once im done with what im working on. thanks again.
 
Old 12-28-2003, 08:15 PM   #11
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Rep: Reputation: 58
I got used to set the time as easy as this on FreeBSD:
date 1400
(which sets the time to 2 pm.)

Linux has the date command, too, so I tried the same, but It did not work: it gave an error "invalid date format" or the like.
I wonder for what the heck it does no longer work on Linux (it worked before!)? Is it a tweak to the date command?

Last edited by J_Szucs; 12-28-2003 at 08:17 PM.
 
Old 12-28-2003, 08:57 PM   #12
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally posted by J_Szucs
I got used to set the time as easy as this on FreeBSD:
date 1400
(which sets the time to 2 pm.)

Linux has the date command, too, so I tried the same, but It did not work: it gave an error "invalid date format" or the like.
I wonder for what the heck it does no longer work on Linux (it worked before!)? Is it a tweak to the date command?
date MMDDhhmm

So you would do this to set the date to today and 2:00 like mentioned above by demonbane and also an easy 'man date' would have given this as well:

date 12281400
 
Old 12-29-2003, 05:53 PM   #13
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Rep: Reputation: 58
Wow, I see now "man" is much more precious on Linux than on FreeBSD, especially with regard to the date command.

Here is how it accepts parameters on Linux:
MMddhhmmYY.ss
(So the year comes between the minute and the seconds. Thats really tricky, I would have never figured it out.)

And here is how it works on FreeBSD:
YYMMddhhmm.ss
It is a bit more straightforward, isn't it?

Though the problem is not the way they work, but the fact that such a simple command works differently on two unixes. Not very good for someone who uses both.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
System time change loccom Linux - General 1 03-16-2005 09:58 AM
Cannot change system time mikemrh9 SUSE / openSUSE 7 01-02-2005 03:06 AM
Change system time JonCooperUK Slackware 4 04-02-2004 09:41 PM
system time is wrong, how do i change? jjd228 Linux - General 8 02-19-2004 04:12 PM
Change system time or date or both lel800 Linux - Newbie 6 10-28-2003 07:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration