Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
a075feba
Kaydet (Commit)
a075feba
authored
Nis 04, 1995
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
changed treatment of local time
üst
02ee80d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
19 deletions
+8
-19
clock.py
Demo/stdwin/clock.py
+8
-19
No files found.
Demo/stdwin/clock.py
Dosyayı görüntüle @
a075feba
...
...
@@ -28,9 +28,6 @@ ORIGIN = 0, 0
FARAWAY
=
2000
,
2000
EVERYWHERE
=
ORIGIN
,
FARAWAY
# TZDIFF = 5*3600 # THINK C 3.0 returns UCT if local time is EST
TZDIFF
=
0
# THINK C 4.0 always returns local time
def
main
():
win
=
makewindow
()
...
...
@@ -89,11 +86,11 @@ def setdimensions(win):
win
.
fullarea
=
ORIGIN
,
win
.
farcorner
def
settimer
(
win
):
now
=
getlocal
time
()
win
.
times
=
calctime
(
now
)
delay
=
61
-
now
%
60
now
=
time
.
time
()
hours
,
minutes
,
seconds
=
win
.
times
=
calctime
(
now
)
delay
=
61
-
seconds
win
.
settimer
(
10
*
delay
)
minutes
=
(
now
/
60
)
%
72
0
minutes
=
minutes
+
hours
*
6
0
if
win
.
ring
:
# Is it time to stop the alarm ringing?
since
=
(
minutes
-
win
.
time
+
720
)
%
720
...
...
@@ -116,7 +113,7 @@ def drawproc(win, area):
d
.
circle
(
win
.
center
,
win
.
radius
)
d
.
line
(
win
.
center
,
calcpoint
(
win
,
hours
*
30
+
minutes
/
2
,
0.6
))
d
.
line
(
win
.
center
,
calcpoint
(
win
,
minutes
*
6
,
1.0
))
str
=
dd
(
hours
)
+
':'
+
dd
(
minutes
)
str
=
"
%02
d:
%02
d"
%
(
hours
,
minutes
)
p
=
(
win
.
width
-
d
.
textwidth
(
str
))
/
2
,
win
.
height
*
3
/
4
d
.
text
(
p
,
str
)
if
win
.
set
:
...
...
@@ -177,7 +174,7 @@ def drawalarmtime(win, d):
# Convert to hours (0..12) and minutes (12*(0..60))
hh
=
win
.
time
/
60
mm
=
win
.
time
%
60
str
=
'Alarm@
'
+
dd
(
hh
)
+
':'
+
dd
(
mm
)
str
=
'Alarm@
%02
d:
%02
d'
%
(
hh
,
mm
)
p1
=
(
win
.
width
-
d
.
textwidth
(
str
))
/
2
,
win
.
height
d
.
text
(
p1
,
str
)
...
...
@@ -189,16 +186,8 @@ def calcpoint(win, degrees, size):
return
h
+
int
(
x
*
size
*
r
),
v
-
int
(
y
*
size
*
r
)
def
calctime
(
now
):
seconds
=
now
%
60
minutes
=
(
now
/
60
)
%
60
hours
=
(
now
/
3600
)
%
12
hours
,
minutes
,
seconds
=
time
.
localtime
(
now
)[
3
:
6
]
hours
=
hours
%
12
return
hours
,
minutes
,
seconds
def
dd
(
n
):
s
=
`n`
return
'0'
*
(
2
-
len
(
s
))
+
s
def
getlocaltime
():
return
int
(
time
.
time
()
-
TZDIFF
)
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment