Skip to content

Commit 0f67981

Browse files
committed
clean up
1 parent 0701e40 commit 0f67981

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

mpd/duration.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (d *Duration) String() string {
5151
u = -u
5252
}
5353

54-
if u <= uint64(time.Second) {
54+
if u < uint64(time.Second) {
5555
// Special case: if duration is smaller than a second,
5656
// use smaller units, like 1.2ms
5757
// time.Duration & zerocoder packages convert seconds to nano ('nS'), micro ('µS') or milliseconds ('mS') with corresponding designation

mpd/duration_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ import (
1010

1111
func TestDuration(t *testing.T) {
1212
in := map[string]string{
13-
"0s": "PT0S",
14-
"6m16s": "PT6M16S",
15-
"1.97s": "PT1.97S",
16-
"0.0021s": "PT0.0021S",
17-
"0.0000021s": "PT0.000002S",
18-
"0.021s": "PT0.021S",
13+
"0s": "PT0S",
14+
"6m16s": "PT6M16S",
15+
"1.97s": "PT1.97S",
16+
"1.0s": "PT1S",
17+
"0.0021s": "PT0.0021S",
18+
"0.0000021s": "PT0.000002S",
19+
"0.021s": "PT0.021S",
1920
}
2021
for ins, ex := range in {
2122
timeDur, err := time.ParseDuration(ins)

0 commit comments

Comments
 (0)