fix ssf h:mm rounding

This commit is contained in:
David Szajngarten 2023-10-12 09:23:00 +00:00
parent 74ed41bb95
commit c2d38f2e07

View File

@ -770,7 +770,7 @@ function eval_fmt(fmt, v, opts, flen) {
/* Round number up if displaying seconds with no microseconds */
if (dt && (dt.S + dt.u >= 59.5) && sec && !usec) {
dt=parse_date_code(Math.round(v), opts)
dt=parse_date_code(Math.round((v - Math.floor(v))*86400)/86400, opts)
}
/* Scan for date/time parts */
@ -799,6 +799,7 @@ function eval_fmt(fmt, v, opts, flen) {
if(dt.u >= 0.5) { dt.u = 0; ++dt.S; }
if(dt.S >= 60) { dt.S = 0; ++dt.M; }
if(dt.M >= 60) { dt.M = 0; ++dt.H; }
if(dt.H >= 24) { dt.H = 0; ++dt.d; }
break;
case 2:
if(dt.u >= 0.5) { dt.u = 0; ++dt.S; }