fixed logger and prevented stacking reset alerts

master
Bel LaPointe 2018-05-25 12:33:24 -06:00
parent 79efedff5a
commit debfeaa0a6
1 changed files with 9 additions and 4 deletions

11
main.go
View File

@ -165,7 +165,7 @@ func printTime(pRemains *time.Duration, target time.Duration, delim *rune, rever
final = rem
} else {
rem := fmt.Sprintf("%2d%c%02d%c%02d ", hrs, byte(*delim), min, byte(*delim), seconds)
final = fmt.Sprintf("%s ", rem)
final = rem + " "
if eta {
final = fmt.Sprintf("%s \tETA: %s", final, time.Unix(0, time.Now().UnixNano()+pRemains.Nanoseconds()).Format("3:04"))
}
@ -173,7 +173,7 @@ func printTime(pRemains *time.Duration, target time.Duration, delim *rune, rever
go alertTime(pRemains, target, reverse, repeat)
}
}
logger.Log("\r%s", final)
logger.Logf("\r%s", final)
}
func alertTime(pRemains *time.Duration, target time.Duration, reverse, repeat bool) {
@ -186,9 +186,14 @@ func alertTime(pRemains *time.Duration, target time.Duration, reverse, repeat bo
if repeat {
originalStart = time.Now()
if reverse {
for *pRemains > 0 {
*pRemains -= target
} else {
}
*pRemains += target
} else {
for *pRemains < 0 {
*pRemains += target
}
}
notified = false
}