UMONS-GFA / ardas

FM Sensors conditionning based on on Arduino
GNU General Public License v3.0
0 stars 1 forks source link

date no synced in raspardas.py #52

Closed bastinc closed 7 years ago

kaufmanno commented 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))

bastinc commented 7 years ago

implement a new cron task in python:

kaufmanno commented 7 years ago

If the NTP server is not available, the raspberry pi clock should be set from the ardas RTC ! see issue #73