File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 1616 */
1717
1818function format_time ( time , full ) {
19- var h = Math . floor ( time / 3600 ) ;
20- var m = Math . floor ( ( time % 3600 ) / 60 ) ;
21- var s = Math . floor ( time % 60 ) ;
19+ var prefix = time < 0 ? "-" : "" ;
20+ var abs_time = Math . abs ( Math . floor ( time ) ) ;
21+ var h = Math . floor ( abs_time / 3600 ) ;
22+ var m = Math . floor ( ( abs_time % 3600 ) / 60 ) ;
23+ var s = Math . floor ( abs_time % 60 ) ;
2224 h = full && h < 10 ? "0" + h : "" + h ;
2325 m = m < 10 ? "0" + m : "" + m ;
2426 s = s < 10 ? "0" + s : "" + s ;
25- return ( h + ":" + m + ":" + s ) ;
27+ return ( prefix + h + ":" + m + ":" + s ) ;
2628} ;
2729
2830function _get_time ( ) {
@@ -142,10 +144,7 @@ var TimeView = new function () {
142144 }
143145 }
144146
145- var time_str = format_time ( Math . abs ( Math . floor ( time ) ) , full_time ) ;
146- if ( time < 0 ) {
147- time_str = '-' + time_str ;
148- }
147+ var time_str = format_time ( time , full_time ) ;
149148
150149 $ ( "#TimeView_time" ) . text ( time_str ) ;
151150 } ;
You can’t perform that action at this time.
0 commit comments