2014-05-14, 14:10
Would love any/all help on the following python-specific question (I've googled around a ton and can't seem to find an answer).
I continue to develop the SageTV Addon and am working on a new enhancement to show upcoming shows for specific time slots. e.g. I can browse time slots like 9-10AM, 10-11AM, etc and then when I click that, it shows me the upcoming shows across channels.
Ideally what I want to do is if it's 8:07AM, I'd like to change the time object to "round down" to make the minutes always 0... so I'd like the "now" variable to be 8:00AM and not 8:07AM.
Thoughts on how best to do this?
I continue to develop the SageTV Addon and am working on a new enhancement to show upcoming shows for specific time slots. e.g. I can browse time slots like 9-10AM, 10-11AM, etc and then when I click that, it shows me the upcoming shows across channels.
Code:
now = time.time()
airTime = strftime('%H:%M', time.localtime(now))
displayText = strftime('%a %b %d', time.localtime(now)) + " @ " + airTime #Which outputs something like "Wed May 14 @ 8:07"
Ideally what I want to do is if it's 8:07AM, I'd like to change the time object to "round down" to make the minutes always 0... so I'd like the "now" variable to be 8:00AM and not 8:07AM.
Thoughts on how best to do this?