Archived:How to compare times using PySymbian
Aquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.
All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.
All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.
Article Metadata
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!!"


27 Sep
2009