Rounded date/time

Asked by Nate Walker

Suggest swapping
            currentMin_int = int(strftime("%M"))
            currentSec_int = int(strftime("%S"))
            timeToWait = 3600 - (currentSec_int + (currentMin_int * 60))
to allow the wallpaper to update on the hour, no matter what time the app is started
from time import strftime
will have to be included as well, but combine this with the nicer date format fix i suggested it would all work out nicely :D )

Question information

English Edit question
Weather wallpaper Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Raúl González Duque (zootropo) said :

The problem is that NOAA reports don't update at 10 o'clock exactly, they may be updated at 10:05, 10:12...
And I don't know if all of them update at the same time.

There should be a value at the NOAA data file telling you when to go back to check for the new values...

Revision history for this message
Nate Walker (kiwinewt) said :

report.getTime().split(' ')[1] will get the time it was created (with the date and time zone subtracted). This may be practically any time zone, depending on how each report is done.
One way around this may be to update every 15min? This likely wouldn't have much effect on the servers, and would mean that the information is always up to date for the user (and its always good to see the time increasing on the output, even if it has nothing else new to show, as the background picture is more likely to change on time as well)
Can be done by:
            currentMin_int = int(strftime("%M"))
            while currentMin_int > 15:
                currentMin_int -= 15
            currentSec_int = int(strftime("%S"))
            timeToWait = 900 -(currentSec_int + (currentMin_int * 60) )
Probably not the fastest or tidiest way to do it but it works

Revision history for this message
Nate Walker (kiwinewt) said :

that code has a bug. it should be:
              while currentMin_int >= 15:
as if the time is xx:15/30/45 the timeToWait becomes less than 0
this sets the currentMin_int on a xx:15/30/45 to 0, therefore giving a full 15min wait before the next update

Revision history for this message
Raúl González Duque (zootropo) said :

I just changed it to 900 seconds. Thanks Nate.

Can you help with this problem?

Provide an answer of your own, or ask Nate Walker for more information if necessary.

To post a message you must log in.