Posts: 2
Joined: Mon Feb 25, 2019 3:16 pm

Using time.time

Mon Feb 25, 2019 3:43 pm

I've found how to read the internal clock value, using python function timeNow= time.time()

My raspberry is not connected to WIFI or internet but it could receive an correct time value from UDP data packets at least once a day.
I've not found how to set the internal time clock counter from my python application.
Unfortunately I've no found any related argument on this forum. Anyone could help me ? thanks

Posts: 6384
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Using time.time

Mon Feb 25, 2019 10:54 pm

To set the date & time on your pi you would need to do it from the command line with the command

Code: Select all

 sudo date -s "25 feb 2019 23:50:00"
you can see all the options by reading the manual, typing

Code: Select all

man date
at the command line

You might also consider fitting you pi with a real time clock like a DS3231 that once set would enable you pi to always have the correct time on boot with or without an internet connection.
We want information… information… information no help
The use of crystal balls & mind reading are not supported

Return to “Python”