Created
January 5, 2021 04:07
-
-
Save mbdevpl/f95acc723f35ab152ca6cd55c680fe59 to your computer and use it in GitHub Desktop.
Millisecond clock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env wish8.6 | |
set intervalms 1 | |
variable theclock | |
proc setclock {} { | |
global intervalms theclock | |
set micros [clock microseconds] | |
set epoch [expr $micros / 1000000] | |
set micros [format "%06d" [expr $micros % 1000000]] | |
# set theclock [clock format $epoch -format "%a %b %d %Y %H:%M:%S.$micros"] | |
set theclock [clock format $epoch -format "%H:%M:%S.$micros"] | |
after $intervalms [list setclock] | |
} | |
font create TtyFont -family "monospace" -size 160 -weight bold | |
pack [label .clock -font TtyFont -textvariable theclock] | |
grid .clock -row 1 -column 1 | |
grid rowconfigure . 1 -weight 1 | |
grid columnconfigure . 1 -weight 1 | |
wm geometry . 1000x200+0+0 | |
setclock |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment