Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 05e46dd

Browse files
committed
Use tzparse to avoid embarrasment in other timezones or when DST changes.
Adapt to new, stricter, rules for argument passing.
1 parent 89a7869 commit 05e46dd

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

Demo/sgi/gl/mclock.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
#! /usr/local/python
2-
3-
#############################################################################
4-
# NOTA BENE: Before installing, fix TZDIFF to reflect your local time zone! #
5-
#############################################################################
1+
#! /usr/local/bin/python
62

73
# "M Clock"
84
#
@@ -44,7 +40,11 @@ class struct: pass # Class to define featureless structures
4440
SCREENBG = 127, 156, 191
4541
NPARTS = 9
4642
TITLE = 'M Clock'
47-
TZDIFF = -2*HOUR # <--- change this to reflect your local time zone
43+
44+
import tzparse
45+
TZDIFF = tzparse.timezone
46+
if tzparse.isdst(time.time()):
47+
TZDIFF = tzparse.altzone
4848

4949
# Default parameters
5050

@@ -412,7 +412,7 @@ def render(list, (little_hand, big_hand, seconds_hand)):
412412
resetindex()
413413
#
414414
if not list:
415-
Gl.c3i(255, 255, 255) # White
415+
Gl.c3i((255, 255, 255)) # White
416416
circf(0.0, 0.0, 1.0)
417417
else:
418418
list.append(3600, 0, 255) # Sentinel
@@ -424,7 +424,7 @@ def render(list, (little_hand, big_hand, seconds_hand)):
424424
[r, g, b] = rgb
425425
if Gl.debug > 1:
426426
print rgb, a_prev, a
427-
Gl.c3i(r, g, b)
427+
Gl.c3i((r, g, b))
428428
arcf(0.0, 0.0, 1.0, a_prev, a)
429429
rgb[icolor] = value
430430
a_prev = a
@@ -433,7 +433,7 @@ def render(list, (little_hand, big_hand, seconds_hand)):
433433
#
434434
# Draw the hands -- in black
435435
#
436-
Gl.c3i(0, 0, 0)
436+
Gl.c3i((0, 0, 0))
437437
#
438438
if Gl.update == 1 and not Gl.iconic:
439439
# Seconds hand is only drawn if we update every second

0 commit comments

Comments
 (0)