Ways to improve this clock algorithm?
Valentino Volonghi aka Dialtone
dialtone#NOSPAM#.despammed at aruba.it
Mon Sep 15 17:45:55 EDT 2003
More information about the Python-list mailing list
Mon Sep 15 17:45:55 EDT 2003
- Previous message (by thread): Ways to improve this clock algorithm?
- Next message (by thread): Ways to improve this clock algorithm?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
jacobsmail at gmx.net (Jacob H) writes: > I am grateful for any suggestions and advice. :) import time class ExampleTimer(object): def __init__(self): print "This is my super clock" self.run() def run(self): while 1: self.update_time() print "%s hrs %s min %s sec" % (self.hours, self.mins, self.secs) time.sleep(1) def update_time(self): # I would use time.localtime() to update the time because doing this I am # sure that it is always syncd with my pc time. I think this is the only # improvement :). It also removes the need for all that math. self.secs = time.localtime()[5] self.mins = time.localtime()[4] self.hours = time.localtime()[3] app = ExampleTimer() app.run() -- Valentino Volonghi, Regia SpA, Milan Linux User #310274, Debian Sid Proud User
- Previous message (by thread): Ways to improve this clock algorithm?
- Next message (by thread): Ways to improve this clock algorithm?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list