diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index d6d1e0c741c..0f84f46497e 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -165,6 +165,7 @@ function convertTime2Seconds($iHours=0, $iMinutes=0, $iSeconds=0) * @param string $format Output format ('all': total delay days hour:min like "2 days 12:30", * - 'allwithouthour': total delay days without hour part like "2 days", * - 'allhourmin': total delay with format hours:min like "60:30", + * - 'allhourminsec': total delay with format hours:min:sec like "60:30:10", * - 'allhour': total delay hours without min/sec like "60:30", * - 'fullhour': total delay hour decimal like "60.5" for 60:30, * - 'hour': only hours part "12", @@ -185,7 +186,7 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt if (empty($lengthOfDay)) $lengthOfDay = 86400; // 1 day = 24 hours if (empty($lengthOfWeek)) $lengthOfWeek = 7; // 1 week = 7 days - if ($format == 'all' || $format == 'allwithouthour' || $format == 'allhour' || $format == 'allhourmin') + if ($format == 'all' || $format == 'allwithouthour' || $format == 'allhour' || $format == 'allhourmin' || $format == 'allhourminsec') { if ((int) $iSecond === 0) return '0'; // This is to avoid having 0 return a 12:00 AM for en_US @@ -232,11 +233,15 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt $sTime.= dol_print_date($iSecond,'hourduration',true); } } - if ($format == 'allhourmin') + elseif ($format == 'allhourminsec') + { + return sprintf("%02d",($sWeek*$lengthOfWeek*24 + $sDay*24 + (int) floor($iSecond/3600))).':'.sprintf("%02d",((int) floor(($iSecond % 3600)/60))).':'.sprintf("%02d",((int) ($iSecond % 60))); + } + elseif ($format == 'allhourmin') { return sprintf("%02d",($sWeek*$lengthOfWeek*24 + $sDay*24 + (int) floor($iSecond/3600))).':'.sprintf("%02d",((int) floor(($iSecond % 3600)/60))); } - if ($format == 'allhour') + elseif ($format == 'allhour') { return sprintf("%02d",($sWeek*$lengthOfWeek*24 + $sDay*24 + (int) floor($iSecond/3600))); } diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 960dcb93516..5017a0af24d 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -409,7 +409,7 @@ print_liste_field_titre("CronDtEnd",$_SERVER["PHP_SELF"],"t.dateend","",$param,' print_liste_field_titre("CronMaxRun",$_SERVER["PHP_SELF"],"t.maxrun","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre("CronNbRun",$_SERVER["PHP_SELF"],"t.nbrun","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre("CronDtLastLaunch",$_SERVER["PHP_SELF"],"t.datelastrun","",$param,'align="center"',$sortfield,$sortorder); -print_liste_field_titre("CronDtLastResult",$_SERVER["PHP_SELF"],"t.datelastresult","",$param,'align="center"',$sortfield,$sortorder); +print_liste_field_titre("Duration",$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre("CronLastResult",$_SERVER["PHP_SELF"],"t.lastresult","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre("CronLastOutput",$_SERVER["PHP_SELF"],"t.lastoutput","",$param,'',$sortfield,$sortorder); print_liste_field_titre("CronDtNextLaunch",$_SERVER["PHP_SELF"],"t.datenextrun","",$param,'align="center"',$sortfield,$sortorder); @@ -438,6 +438,9 @@ if ($num > 0) $object->priority = $obj->priority; $object->processing = $obj->processing; + $datelastrun = $db->jdate($obj->datelastrun); + $datelastresult = $db->jdate($obj->datelastresult); + print '