mirror of
https://github.com/python/cpython.git
synced 2025-11-12 23:16:47 +00:00
Use tzparse to avoid embarrasment in other timezones or when DST changes.
Adapt to new, stricter, rules for argument passing.
This commit is contained in:
parent
89a78697b8
commit
05e46ddec4
1 changed files with 9 additions and 9 deletions
|
|
@ -1,8 +1,4 @@
|
||||||
#! /usr/local/python
|
#! /usr/local/bin/python
|
||||||
|
|
||||||
#############################################################################
|
|
||||||
# NOTA BENE: Before installing, fix TZDIFF to reflect your local time zone! #
|
|
||||||
#############################################################################
|
|
||||||
|
|
||||||
# "M Clock"
|
# "M Clock"
|
||||||
#
|
#
|
||||||
|
|
@ -44,7 +40,11 @@ Gl = struct() # Object to hold writable global variables
|
||||||
SCREENBG = 127, 156, 191
|
SCREENBG = 127, 156, 191
|
||||||
NPARTS = 9
|
NPARTS = 9
|
||||||
TITLE = 'M Clock'
|
TITLE = 'M Clock'
|
||||||
TZDIFF = -2*HOUR # <--- change this to reflect your local time zone
|
|
||||||
|
import tzparse
|
||||||
|
TZDIFF = tzparse.timezone
|
||||||
|
if tzparse.isdst(time.time()):
|
||||||
|
TZDIFF = tzparse.altzone
|
||||||
|
|
||||||
# Default parameters
|
# Default parameters
|
||||||
|
|
||||||
|
|
@ -412,7 +412,7 @@ def render(list, (little_hand, big_hand, seconds_hand)):
|
||||||
resetindex()
|
resetindex()
|
||||||
#
|
#
|
||||||
if not list:
|
if not list:
|
||||||
Gl.c3i(255, 255, 255) # White
|
Gl.c3i((255, 255, 255)) # White
|
||||||
circf(0.0, 0.0, 1.0)
|
circf(0.0, 0.0, 1.0)
|
||||||
else:
|
else:
|
||||||
list.append(3600, 0, 255) # Sentinel
|
list.append(3600, 0, 255) # Sentinel
|
||||||
|
|
@ -424,7 +424,7 @@ def render(list, (little_hand, big_hand, seconds_hand)):
|
||||||
[r, g, b] = rgb
|
[r, g, b] = rgb
|
||||||
if Gl.debug > 1:
|
if Gl.debug > 1:
|
||||||
print rgb, a_prev, a
|
print rgb, a_prev, a
|
||||||
Gl.c3i(r, g, b)
|
Gl.c3i((r, g, b))
|
||||||
arcf(0.0, 0.0, 1.0, a_prev, a)
|
arcf(0.0, 0.0, 1.0, a_prev, a)
|
||||||
rgb[icolor] = value
|
rgb[icolor] = value
|
||||||
a_prev = a
|
a_prev = a
|
||||||
|
|
@ -433,7 +433,7 @@ def render(list, (little_hand, big_hand, seconds_hand)):
|
||||||
#
|
#
|
||||||
# Draw the hands -- in black
|
# Draw the hands -- in black
|
||||||
#
|
#
|
||||||
Gl.c3i(0, 0, 0)
|
Gl.c3i((0, 0, 0))
|
||||||
#
|
#
|
||||||
if Gl.update == 1 and not Gl.iconic:
|
if Gl.update == 1 and not Gl.iconic:
|
||||||
# Seconds hand is only drawn if we update every second
|
# Seconds hand is only drawn if we update every second
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue