File tree Expand file tree Collapse file tree 1 file changed +14
-16
lines changed Expand file tree Collapse file tree 1 file changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -18,25 +18,23 @@ def elapsed_text(elapsed)
1818 " #{ (millis * 1000 ).round(2 ) } µs"
1919end
2020
21- def decode_time_span (string : String ) : Time ::Span
22- time_span = string.gsub(/[^0-9:] / , " " )
23- return Time ::Span .new(seconds: 0 ) if time_span.empty?
24-
25- time_span = time_span.split(" :" ).map { |x | x.to_i? || 0 }
26- time_span = [0 ] * (3 - time_span.size) + time_span
27-
28- return Time ::Span .new(
29- hours: time_span[0 ],
30- minutes: time_span[1 ],
31- seconds: time_span[2 ]
32- )
33- end
21+ def decode_length_seconds (string )
22+ length_seconds = string.gsub(/[^0-9:] / , " " )
23+ return 0 _i32 if length_seconds.empty?
24+
25+ length_seconds = length_seconds.split(" :" ).map { |x | x.to_i? || 0 }
26+ length_seconds = [0 ] * (3 - length_seconds.size) + length_seconds
27+
28+ length_seconds = Time ::Span .new(
29+ hours: length_seconds[0 ],
30+ minutes: length_seconds[1 ],
31+ seconds: length_seconds[2 ]
32+ ).total_seconds.to_i32
3433
35- def decode_length_seconds (string : String ) : Int32
36- return decode_time_span(string).total_seconds.to_i32
34+ return length_seconds
3735end
3836
39- def recode_length_seconds (time : Int32 ) : String
37+ def recode_length_seconds (time )
4038 if time <= 0
4139 return " "
4240 else
You can’t perform that action at this time.
0 commit comments