LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to change the system time? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-change-the-system-time-129397/)

h/w 12-27-2003 09:25 PM

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.

peok 12-27-2003 09:49 PM

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.

brew1brew 12-27-2003 09:50 PM

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.

h/w 12-27-2003 10:16 PM

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

Demonbane 12-27-2003 10:35 PM

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.

brew1brew 12-28-2003 02:48 AM

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.

teona 12-28-2003 12:32 PM

I had a problem with time before, and changeing the time/date in the BIOS will change it in linux aswell...:)

trickykid 12-28-2003 12:40 PM

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.. ;)

teona 12-28-2003 12:42 PM

oh sory, yes I forgott to mention that :)

h/w 12-28-2003 01:10 PM

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.

J_Szucs 12-28-2003 08:15 PM

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?

trickykid 12-28-2003 08:57 PM

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

J_Szucs 12-29-2003 05:53 PM

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.


All times are GMT -5. The time now is 06:56 PM.