diff --git a/src/shared-endpoints.ts b/src/shared-endpoints.ts index d70d92a..b7bae2d 100644 --- a/src/shared-endpoints.ts +++ b/src/shared-endpoints.ts @@ -132,4 +132,12 @@ export default class SharedEndpoints { getApiAnnouncements(): GenericAPIResponse { return this.requestWrapper.get('v2/public/announcement'); } + + async getTimeOffset(): Promise { + const start = Date.now(); + return this.getServerTime().then(result => { + const end = Date.now(); + return Math.ceil((result.time_now * 1000) - end + ((end - start) / 2)); + }); + } }