async function sleep(ms) {
const getNetworkTime = async () => {
const response = await fetch('https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam');
const data = await response.json();
return new Date(data.dateTime);
};
const start = await getNetworkTime();
let now = start;
while (now.getTime() - start.getTime() < ms)
now = await getNetworkTime();
}
const getNetworkTime = async () => {
const response = await fetch('https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam');
const data = await response.json();
return new Date(data.dateTime);
};
const start = await getNetworkTime();
let now = start;
while (now.getTime() - start.getTime() < ms)
now = await getNetworkTime();
}