add time tracking

This commit is contained in:
matthias@arch 2023-12-09 13:11:52 +01:00
parent c24f9d6080
commit 35512acca9

View File

@ -28,6 +28,7 @@ start.addEventListener("click", () => {
function findPosition(line) { function findPosition(line) {
console.time("day06")
let i = 4; let i = 4;
let packetStart = line.substring(0, 4); // should always contain 4 chars let packetStart = line.substring(0, 4); // should always contain 4 chars
let messageStart = line.substring(0, 14); // should always contain 14 chars let messageStart = line.substring(0, 14); // should always contain 14 chars
@ -51,6 +52,7 @@ function findPosition(line) {
else { else {
output.innerHTML = "Found the first packet start marker at position <b>" + packetStartI + "</b>, the marker is " + packetStart + "<br>" + output.innerHTML = "Found the first packet start marker at position <b>" + packetStartI + "</b>, the marker is " + packetStart + "<br>" +
"Found the first message start marker at position <b>" + i + "</b>, the marker is " + messageStart + "\n"; "Found the first message start marker at position <b>" + i + "</b>, the marker is " + messageStart + "\n";
console.timeEnd("day06")
return; return;
} }
} }