Fixed implimentation, added to openapi.json

This commit is contained in:
Marc Ole Bulling 2020-12-28 11:58:45 +01:00
parent 011fa8117d
commit 2285e290ff
No known key found for this signature in database
GPG Key ID: C126AFC2A47B06FF
2 changed files with 66 additions and 1 deletions

View File

@ -146,6 +146,41 @@
}
}
},
"/system/time": {
"get": {
"summary": "Returns the current server time",
"tags": [
"System"
],
"parameters": [
{
"$ref": "#/components/parameters/offsettime"
}
],
"responses": {
"200": {
"description": "A TimeResponse object",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TimeResponse"
}
}
}
},
"400": {
"description": "The operation was not successful",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error400"
}
}
}
}
}
}
},
"/system/log-missing-localization": {
"post": {
"summary": "Logs a missing localization string",
@ -5170,6 +5205,28 @@
}
}
},
"TimeResponse": {
"type": "object",
"properties": {
"timezone": {
"type": "string"
},
"time_local": {
"type": "string",
"format": "date-time"
},
"time_utc": {
"type": "string",
"format": "date-time"
},
"timestamp": {
"type": "integer"
},
"offset": {
"type": "integer"
}
}
},
"UserSetting": {
"type": "object",
"properties": {
@ -5222,6 +5279,15 @@
"type": "integer"
}
},
"offsettime": {
"in": "query",
"name": "offset",
"required": false,
"description": "Offset of timestamp in seconds. Can be positive or negative.",
"schema": {
"type": "integer"
}
},
"query": {
"in": "query",
"name": "query[]",

View File

@ -78,7 +78,6 @@ class ApplicationService extends BaseService
private static function convertToUtc(int $timestamp):string
{
$timestamp = time();
$dt = new \DateTime('now', new \DateTimeZone('UTC'));
$dt->setTimestamp($timestamp);
return $dt->format('Y-m-d H:i:s');