antonmedv / countdown

Terminal countdown timer
MIT License
1.06k stars 108 forks source link

Fix that getting wrong hours from modified duration #8

Closed mingrammer closed 5 years ago

mingrammer commented 5 years ago

d has been modified, so it does not equal original value. So d.Hours() always returns 0 because the hours part was already subtracted from d.

h := d / time.Hour
d -= h * time.Hour

It should use h instead.