Posts Tagged ‘Linino’

Set clock on Arduino Yún

January 14, 2014

In my Arduino Yún project, I’d had the problem of sometimes writing to the log file before the clock had been set (so the log had the wrong date and time). To avoid this, I wanted to force the clock to be set as part of my Arduino sketch.

After poking about on the Linino side of the Yún, I figured it out.

You use ntpd, like this:

p.runShellCommand("ntpd -qn -p");

I figured this out by ssh-ing to the Yún and using ps to see what processes were running. I figured I might be looking for ntp, so I used

ps | grep ntp

I don’t know why the command uses the 0. in, but didn’t work, and the command I saw running in the results from ps used it.