Closed bastinc closed 7 years ago
Here is a code snippet to get a datetime from a pool of NTP servers and generate the ardas command to set the new date...
import ntplib import datetime from time import ctime c = ntplib.NTPClient() now = datetime.datetime.utcfromtimestamp(c.request('europe.pool.ntp.org').tx_time) message = print('#SD %04d %02d %02d %02d %02d %02d' %(now.year, now.month, now.day, now.hour, now.minute, now.second))
implement a new cron task in python:
If the NTP server is not available, the raspberry pi clock should be set from the ardas RTC ! see issue #73
Here is a code snippet to get a datetime from a pool of NTP servers and generate the ardas command to set the new date...
import ntplib import datetime from time import ctime c = ntplib.NTPClient() now = datetime.datetime.utcfromtimestamp(c.request('europe.pool.ntp.org').tx_time) message = print('#SD %04d %02d %02d %02d %02d %02d' %(now.year, now.month, now.day, now.hour, now.minute, now.second))