python2.7 on ubuntu XU4

Moderators: mdrjr, odroid

python2.7 on ubuntu XU4

Unread postby gbsutter » Fri Jul 13, 2018 4:31 am

Hi
My project is embedded and will have no connection to internet post-production.
How can I set time and date programatically with a user interface?
Probably related, how can I shut down under program control?
Input much appreciated.
Graham.
gbsutter
 
Posts: 12
Joined: Tue Jan 16, 2018 1:59 am
languages_spoken: english, french
ODROIDs: XU4

Re: python2.7 on ubuntu XU4

Unread postby mad_ady » Fri Jul 13, 2018 12:45 pm

You can set the date to an arbitrary one with the date command:
Code: Select all
date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]

For example
Code: Select all
date 071308002018
would set it to 13.07.2018 08:00.
You can also install and use fakehwclock which saves and restores your current time on reboot. This is useful if the system is mostly on, but can suffer an occasional reboot. There will be some time drift though...
User avatar
mad_ady
 
Posts: 4034
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: python2.7 on ubuntu XU4

Unread postby gbsutter » Sat Jul 14, 2018 1:08 am

Thanks mad_ady
I just learned how to call command line entries from my python code, so I can immediately apply your advice.
The drift is expected and I have a user interface for corrections and zone changes.
Graham.
gbsutter
 
Posts: 12
Joined: Tue Jan 16, 2018 1:59 am
languages_spoken: english, french
ODROIDs: XU4


Return to Ubuntu

Who is online

Users browsing this forum: No registered users and 2 guests