Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two computers, but I can´t change the time in one, so I have to sync one of this, with the other one. It has QNX. What can I do?? only commands

share|improve this question
how about using ntp? – MaQleod Apr 3 '13 at 18:39
@MaQleod the OP does not have root access to both machines so that is not an option. That's what I understood by "I can´t change the time in one". – terdon Apr 3 '13 at 19:23
up vote 1 down vote accepted

The best solution would be to install NTP on both machines and have them sync to the same server. This is not an option, of course, if you only have root access to one of the two.

Assuming that you have ssh access to both machines, that machine1 is the one whose date you cannot change and machine2 the one whose date you can change (as the root user), you can do something like this:

remote_time=`ssh user@machine1 date` && date -s $remote_time

You will need to change user to your user name on machine1. If you run this command when logged in as root on machine2, you will set its date to the same value as machine1.


The command above will ssh as the user user to machine1 and save the result of date (the current time and date for machine1) into the variable $remote_time. If the ssh exits successfully (&&), the second part of the command will set the time of machine2 (the machine the command was run from) to the value of $remote_time.

CAVEAT: The two commands take some time to complete. When I tested them on my machine, they took 0.3 seconds, it could take more on yours. Just be aware that if you need millisecond accuracy, this will not work. Then again, if you need millisecond accuracy, the only thing that will work is syncing both machines to an NTP server.

share|improve this answer
That's exactly what I was looking for, thanks. – Evaristoyok Apr 7 '13 at 20:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .