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

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to