time between now and the next 2:30 am?
John Nagle
nagle at animats.com
Sat Jul 24 03:11:09 EDT 2010
On 7/23/2010 10:01 AM, Jim wrote:
> How can I calculate how much time is between now and the next 2:30
> am? Naturally I want the system to worry about leap years, etc.
>
> Thanks,
> Jim
DAYSECS = 24*60*60
GOALSECS = (2*60 + 30)*60
now = (GOALSECS + DAYSECS - (int(time.time()) % DAYSECS)) % DAYSECS
This is for UT; the adjustment for timezone should be obvious.
John Nagle
More information about the Python-list
mailing list