32 lines
418 B
Go
Executable File
32 lines
418 B
Go
Executable File
package main
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
type BasicTimer struct {
|
|
*Timer
|
|
}
|
|
|
|
func NewBasicTimer(t *Timer) string {
|
|
b := &BasicTimer{Timer: t}
|
|
return b.String()
|
|
}
|
|
|
|
func (t *BasicTimer) left() string {
|
|
cur := t.Remaining()
|
|
return fmt.Sprintf(
|
|
"%02d:%02d:%02d",
|
|
int(cur.Hours()),
|
|
int(cur.Minutes())%60,
|
|
int(cur.Seconds())%60,
|
|
)
|
|
}
|
|
|
|
func (t *BasicTimer) String() string {
|
|
return fmt.Sprintf(
|
|
"%s",
|
|
t.left(),
|
|
)
|
|
}
|