6

Currently I'm working on an application on my RPi which will be monitoring a set of GPIOs in real-time where the exact time when the GPIO turns HIGH is crucial for my application.

How the time is being dealt with on the RPi with the Arch Linux OS; is it synchronized towards a UDP NTP Time Server? If that's the case, is it being updated continuously in a background thread/daemon like other Linux installations? Or is it perhaps updated each time a call to get the time is made?

Because two events might occur on two (or more) GPIOs simultaneously I need to implement the fastest solution possible to get the real-time functionality.

The actual date is not important when the specific event happens; instead, the exact time relative to the other events is. The data recorded will be shown in a graph where the spacing between the events should be as exact as possible.

How is time handled on the RPi with Arch Linux, and how accurate is it in a multi-threaded environment?

  • You can choose between using ntp or systemd-timesyncd (I would recommend the latter in conjuction with systemd-networkd). – jasonwryan Jul 24 '14 at 23:16
  • @jasonwryan Sorry, but I'm rather new to Linux and I don't really understand what systemd-timesyncd and systemd-networkd, An explanation would be greatly appreciated! Thank you. Nevermind, I missed your hyperlink to the systemd-timesyncd explanation. :S – Linus Jul 24 '14 at 23:19
  • No problem: this might also be helpful for context. – jasonwryan Jul 24 '14 at 23:23
5

As with most things in Arch, there isn't a default time management tool set up; you can choose between several time synchronisation options.

Give the RaspberryPi's lack of a RTC, I would suggest that you ensure that you use a tool that can store the last time to disk and then references that at boot time to pull the clock out of the dawn of UNIX time.

Using a combination of systemd-timesyncd, with an optional configuration file for your preferred time servers in /etc/systemd/timesyncd.conf, and systemd-networkd will bring your network up swiftly at boot and correct any drift in your clock as early as practicably possible. The daemon will then sync your clock at periodic intervals (around every 30 minutes).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.