refactor: more css purging
This commit is contained in:
17
src/time-sync.ts
Normal file
17
src/time-sync.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { unixNowMs } from "@snort/shared";
|
||||
|
||||
export let TimeSync = 0;
|
||||
|
||||
export async function syncClock() {
|
||||
try {
|
||||
const req = await fetch("https://api.zap.stream/api/time", {
|
||||
signal: AbortSignal.timeout(1000),
|
||||
});
|
||||
const nowAtServer = (await req.json()).time as number;
|
||||
const now = unixNowMs();
|
||||
TimeSync = now - nowAtServer;
|
||||
console.debug("Time clock sync", TimeSync);
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user