I have an embedded system that runs Ubuntu 14 and is connected to my laptop through an Ethernet cable. I am trying to sync the time/date/timezone of the board with my laptop. The board does not have any Internet connectivity and I can not run ntp
like ntpdate ntp.ubuntu.com
.
What I have in mind is to get the time/date/time-zone of my laptop using a C++ code like this and then run date --set=<laptop_time_date>
command on the remote board (using a remote SSH connection). Is this the correct way to do this? and how to syn the time zones too?
P.S. The reason I need to sync the time/date of the board with my laptop is to let make
to work properly. I copy multiple source files through SSH connection to the board and then call make to build the program. make produces a warning that timestamp of file is in the future. One way to solve this is to call touch on all the source files to update the time stamps, but it forces a rebuild.