File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -10,12 +10,13 @@ import (
1010
1111func 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 )
You can’t perform that action at this time.
0 commit comments