I have my Raspberry Pi hooked up to 16 x 2 character display the date on launch.

The display has a i2c module on the

I have placed this in crontab (without the sudo thingy, so user) :

@reboot sudo python /home/pi/myFolder/DisplayFirst.py

This runs this python file:

import pylcdlib
import time
display = pylcdlib.lcd()
g = time.strftime('%I:%M:%S %p')

However this displays the time from when the raspberry pi was last turned on.

  • As far as know, @reboot cronjobs runs when device boots up. So it is logical to see time when Rpi was last turned on. Aug 17, 2017 at 15:19
  • @dhruvvyas90 It does not display the time it was turned on but the time before I turned it on... for example if I turned it on yesterday at 5pm then if I turned it on today it would display 5pm even though today I may switch it on at 3pm
    – Ben
    Aug 17, 2017 at 15:22
  • One of the possible reason could be reboot cron being executed before NTP kicks in, ie, NTP is responsible for fetching the time from internet since RPi doesn't have an RTC. So system time is basically the same as when you previously turned it off. You should execute this command after 1 minute of reboot to see if it makes any difference. Aug 17, 2017 at 15:45
  • In order to check if that's the problem you are facing, have a look at this option. raspberrypi.stackexchange.com/questions/45769/… Aug 17, 2017 at 16:10


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.