1848747 Members
6067 Online
104036 Solutions
New Discussion

Re: set time to seconds

 
Jose Anaya_1
Occasional Contributor

set time to seconds

How to do I set the time to seconds?
I have saw only to minutes,(date mmddhhmm)


regards
Jos??

nitcom
2 REPLIES 2
Pete Randall
Outstanding Contributor

Re: set time to seconds

Jose,

If you want to be that accurate with the time, you should consider implementing NTP (see man xntpd). Otherwise, pre-type your date command and wait for the second hand on your watch to hit 0. Press enter exactly when it does hit zero.


Pete


Pete
Mark Greene_1
Honored Contributor

Re: set time to seconds

Set the time to minutes, doing so as close the minute as possible, but not after. It's better to be behind on the time than a head, because moving the clock backwards has more dire consequences than moving it forwards.

Then, you can use the -a option of the date command to fine-tune the seconds. From the man page for date:

" -a [-]sss[.fff]
Slowly adjust the time by sss.fff seconds (fff represents
fractions of a second). This adjustment can be positive or
negative. The system's clock will be sped up or slowed down
until it has drifted by the number of seconds specified."

mark
the future will be a lot like now, only later