Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bareos/bareos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Bergkemper <frank.bergkemper@bareos.com>2022-10-18 17:09:06 +0300
committerFrank Bergkemper <frank.bergkemper@bareos.com>2022-11-03 19:33:15 +0300
commit1d2bbd77f8d6259b83a91b8a3489f47d27d34939 (patch)
tree56e2572cefd3c77191b7b34121c784dbf86a58d4
parent8a477804fa43c6fd45df9abee52b30832e0af833 (diff)
webui: fix job timeline x-axis UTC timestamp issue
We need to explicitly convert the retrieved timestamps to UTC timestamps and push those formatted to seconds since Unix epoch into the chart.
-rw-r--r--webui/module/Job/src/Job/Controller/JobController.php15
1 files changed, 5 insertions, 10 deletions
diff --git a/webui/module/Job/src/Job/Controller/JobController.php b/webui/module/Job/src/Job/Controller/JobController.php
index 694d6d8f6..d17a88664 100644
--- a/webui/module/Job/src/Job/Controller/JobController.php
+++ b/webui/module/Job/src/Job/Controller/JobController.php
@@ -754,16 +754,11 @@ class JobController extends AbstractActionController
$jobs = array();
- // Ensure a proper date.timezone setting for the job timeline.
- // Surpress a possible error thrown by date_default_timezone_get()
- // in older PHP versions with @ in front of the function call.
- date_default_timezone_set(@date_default_timezone_get());
-
foreach($result as $job) {
- $starttime = new \DateTime($job['starttime']);
- $endtime = new \DateTime($job['endtime']);
- $schedtime = new \DateTime($job['schedtime']);
+ $starttime = new \DateTime($job['starttime'], new \DateTimeZone('UTC'));
+ $endtime = new \DateTime($job['endtime'], new \DateTimeZone('UTC'));
+ $schedtime = new \DateTime($job['schedtime'], new \DateTimeZone('UTC'));
$starttime = $starttime->format('U')*1000;
$endtime = $endtime->format('U')*1000;
@@ -783,7 +778,7 @@ class JobController extends AbstractActionController
case 'R':
case 'l':
$fillcolor = "#5bc0de";
- $endtime = new \DateTime(null);
+ $endtime = new \DateTime(null, new \DateTimeZone('UTC'));
$endtime = $endtime->format('U')*1000;
break;
// FAILED
@@ -806,7 +801,7 @@ class JobController extends AbstractActionController
case 'p':
case 'q':
$fillcolor = "#555555";
- $endtime = new \DateTime(null);
+ $endtime = new \DateTime(null, new \DateTimeZone('UTC'));
$endtime = $endtime->format('U')*1000;
break;
default: