RosettaCodeData/Task/Draw-a-clock/Yabasic/draw-a-clock-1.basic

35 lines
691 B
Plaintext

clear screen
open window 300,100
backcolor 0, 0, 0
window origin "cc"
// Display digital clock
sub digital_clock()
local t$(1), void
static as$
void = token(time$, t$(), "-")
if t$(3) <> as$ then
draw_clock(t$(1), t$(2), t$(3))
as$ = t$(3)
end if
end sub
sub draw_clock(hour$, mint$, ssec$)
local d$(1), void
void = token(date$, d$(), "-")
clear window
color 200, 255, 0
text -140, -30, d$(3) + "/" + d$(2) + "/" + d$(4), "modern12"
text 0, 0, hour$ + ":" + mint$ + ":" + ssec$, "cc", "swiss50"
end sub
if peek$("library") = "main" then
repeat
digital_clock()
until(upper$(inkey$(.01))="ESC")
exit
end if