×
Namespaces

Variants
Actions
(Redirected from How to compare time)

Archived:How to compare times using PySymbian

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngAquivado: 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.

Article Metadata
Article
Created: User:Kandyfloss (07 Apr 2008)
Last edited: hamishwillee (31 May 2013)


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!!"
This page was last modified on 31 May 2013, at 04:08.
51 page views in the last 30 days.
×