Updated “ght” calls to its new format

This commit is contained in:
pezcurrel 2023-12-31 20:27:15 +01:00
parent 6a750a2f3c
commit 53a03f1c7a

View file

@ -50,8 +50,6 @@ $opts=[
'minmsgimplev'=>1 'minmsgimplev'=>1
]; ];
$ghtsa=[[' day',' days'],[' hour',' hours'],[' minute',' minutes'],[' second',' seconds']];
$help='SYNOPSIS $help='SYNOPSIS
'.SNAME.' [options] '.SNAME.' [options]
@ -71,7 +69,7 @@ OPTIONS
If an instance has not been responding for longer than this time, avoid If an instance has not been responding for longer than this time, avoid
checking it. See section «TIME SPECIFICATION» below to see how to specify checking it. See section «TIME SPECIFICATION» below to see how to specify
time. time.
DEFAULT: '.ght($opts['gracetime'],$ghtsa).' DEFAULT: '.ght($opts['gracetime'],null,0).'
-G, --graceline -G, --graceline
Return the “graceline” (now - gracetime: see option above) in unix time and Return the “graceline” (now - gracetime: see option above) in unix time and
local time, then exit. local time, then exit.
@ -315,7 +313,7 @@ do {
fclose($pipes[$key][0]); fclose($pipes[$key][0]);
$rv=proc_close($procs[$key]['proc']);// this always returns -1, it seems it's a php bug, anyway i'm keeping it for now to stay on the safe side (?) $rv=proc_close($procs[$key]['proc']);// this always returns -1, it seems it's a php bug, anyway i'm keeping it for now to stay on the safe side (?)
$done++; $done++;
$out='proc slot '.$key.': finished running on «'.$proc['host'].'» after '.ght($now-$proc['begts']).' (exit code: '.$pstat['exitcode'].')'; $out='proc slot '.$key.': finished running on «'.$proc['host'].'» after '.ght($now-$proc['begts'],null,0).' (exit code: '.$pstat['exitcode'].')';
if ($instk<$cinsts-1) { if ($instk<$cinsts-1) {
$instk++; $instk++;
$host=$insts[$instk]; $host=$insts[$instk];
@ -328,13 +326,13 @@ do {
} }
eecho(1,$out); eecho(1,$out);
} else { } else {
eecho(0,'proc slot '.$key.': been running on «'.$proc['host'].'» for '.ght($now-$proc['begts']).'.'.N); eecho(0,'proc slot '.$key.': been running on «'.$proc['host'].'» for '.ght($now-$proc['begts'],null,0).'.'.N);
$somerun=true; $somerun=true;
} }
} }
} }
$out=$done.'/'.$cinsts.' ('.round(100/$cinsts*$done).'%); elapsed time: '.ght($tet); $out=$done.'/'.$cinsts.' ('.round(100/$cinsts*$done).'%); elapsed time: '.ght($tet,null,0);
if ($done>0) $out.='; estimated time remaining: '.ght($cinsts*$tet/$done-$tet); if ($done>0) $out.='; estimated time remaining: '.ght($cinsts*$tet/$done-$tet,null,0);
eecho(1,$out.'.'.N); eecho(1,$out.'.'.N);
if ($somerun) { if ($somerun) {
writestatus($statusjfp,$opts,$instk,$tet,$done,$procs); writestatus($statusjfp,$opts,$instk,$tet,$done,$procs);