Added time function from inverse

This commit is contained in:
peepopoggers
2021-01-28 23:40:16 +00:00
parent 0fe804413b
commit 55266b625e

View File

@@ -132,4 +132,12 @@ export default class SharedEndpoints {
getApiAnnouncements(): GenericAPIResponse {
return this.requestWrapper.get('v2/public/announcement');
}
async getTimeOffset(): Promise<number> {
const start = Date.now();
return this.getServerTime().then(result => {
const end = Date.now();
return Math.ceil((result.time_now * 1000) - end + ((end - start) / 2));
});
}
}