68 lines
1.1 KiB
Plaintext
68 lines
1.1 KiB
Plaintext
import concurrent.{scheduleAtFixedRate, scheduler}
|
|
|
|
val ROW = 10
|
|
val COL = 20
|
|
val digits = array( [
|
|
" __",
|
|
" / /",
|
|
"/__/ ",
|
|
" ",
|
|
" /",
|
|
" / ",
|
|
" __",
|
|
" __/",
|
|
"/__ ",
|
|
" __",
|
|
" __/",
|
|
" __/ ",
|
|
" ",
|
|
" /__/",
|
|
" / ",
|
|
" __",
|
|
" /__ ",
|
|
" __/ ",
|
|
" __",
|
|
" /__ ",
|
|
"/__/ ",
|
|
" __",
|
|
" /",
|
|
" / ",
|
|
" __",
|
|
" /__/",
|
|
"/__/ ",
|
|
" __",
|
|
" /__/",
|
|
" __/ "
|
|
] )
|
|
val colon = array( [
|
|
" ",
|
|
" .",
|
|
". "
|
|
] )
|
|
|
|
def displayTime =
|
|
def pad( n ) = if n < 10 then '0' + n else n
|
|
|
|
t = $time
|
|
s = (t + $timeZoneOffset)\1000%86400
|
|
time = pad( s\3600 ) + ':' + pad( s%3600\60 ) + ':' + pad( s%60 )
|
|
|
|
for row <- 0:3
|
|
print( if $os.startsWith('Windows') then '\n' else '\u001B[' + (ROW + row) + ';' + COL + 'H' )
|
|
|
|
for ch <- time
|
|
print( if ch == ':' then colon(row) else digits(int(ch)*3 + row) )
|
|
|
|
println()
|
|
t
|
|
|
|
if not $os.startsWith( 'Windows' )
|
|
print( '\u001B[2J\u001B[?25l' )
|
|
|
|
scheduleAtFixedRate( displayTime, 1000 - displayTime()%1000, 1000 )
|
|
readLine()
|
|
scheduler().shutdown()
|
|
|
|
if not $os.startsWith( 'Windows' )
|
|
print( '\u001B[?25h' )
|