refactor
This commit is contained in:
22
pkg/clock/digit/digit.go
Normal file
22
pkg/clock/digit/digit.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
d, err := time.ParseDuration("1s")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
t := time.Tick(d)
|
||||
go func() {
|
||||
fmt.Printf("\033[2J\033[H")
|
||||
for {
|
||||
<-t
|
||||
fmt.Printf("\r%s", time.Now().Format(time.TimeOnly))
|
||||
}
|
||||
}()
|
||||
select {}
|
||||
}
|
||||
Reference in New Issue
Block a user