diff --git a/controllers/SystemApiController.php b/controllers/SystemApiController.php index 6725fa04..4b47bbdb 100644 --- a/controllers/SystemApiController.php +++ b/controllers/SystemApiController.php @@ -46,8 +46,9 @@ class SystemApiController extends BaseApiController public function GetSystemTime(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args) { $offset = 0; - if (isset($args['offset'])) - $offset = $args['offset']; + $params = $request->getQueryParams(); + if (isset($params['offset'])) + $offset = $params['offset']; return $this->ApiResponse($response, $this->getApplicationService()->GetSystemTime($offset)); } diff --git a/services/ApplicationService.php b/services/ApplicationService.php index 6dc78dfa..3b60a630 100644 --- a/services/ApplicationService.php +++ b/services/ApplicationService.php @@ -79,7 +79,7 @@ class ApplicationService extends BaseService private static function convertToUtc(int $timestamp):string { $timestamp = time(); - $dt = new DateTime('now', new DateTimeZone('UTC')); + $dt = new \DateTime('now', new \DateTimeZone('UTC')); $dt->setTimestamp($timestamp); return $dt->format('Y-m-d H:i:s'); } @@ -91,7 +91,7 @@ class ApplicationService extends BaseService */ public function GetSystemTime(int $offset = 0):array { - $timestamp = time(); + $timestamp = time()+$offset; $timeLocal = date('Y-m-d H:i:s', $timestamp); $timeUTC = self::convertToUtc($timestamp); return [