×
Namespaces

Variants
Actions
Revision as of 08:24, 7 February 2012 by hamishwillee (Talk | contribs)

Archived:How to compare times using PySymbian

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: User:Kandyfloss (07 Apr 2008)
Last edited: hamishwillee (07 Feb 2012)


The below code is useful for comparing two times in python. It can be used to develop an application like customized calendar or alarm clock.

import e32
import time
 
def wait():
t = list(time.localtime())
n = time.mktime(t)
t[3] = t[4] = t[5] = 0
t[2] += 1
return time.mktime(t) - n
 
timer=e32.Ao_timer()
w = wait()
while w > 60:
h = w / 3600
m = w % 3600 / 60
s = w % 60
print "waiting %02d:%02d:%02d ..." % (h, m, s)
timer.after(s or 60)
w = wait()
 
timer.after(w)
print "It's time!!"
41 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×