-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelay.html
46 lines (43 loc) · 1.29 KB
/
delay.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Current Time</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
background-color: #f0f0f0;
}
#time {
font-size: 3rem;
color: #333;
}
</style>
</head>
<body>
<div id="time"></div>
<script>
function updateTime() {
const now = new Date();
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
const milliseconds = String(now.getMilliseconds()).padStart(3, '0');
document.getElementById('time').textContent = `${hours}:${minutes}:${seconds}.${milliseconds}`;
}
// Update the time as fast as possible using requestAnimationFrame
function loop() {
updateTime();
requestAnimationFrame(loop);
}
// Start the loop
loop();
</script>
</body>
</html>