import {
    world,
    system
} from "@minecraft/server";

let hoursPassed = 0;
let minutesPassed = 0;
let secondsPassed = 0;

function mainTick() {
    if (system.currentTick % 20 === 0) {
        secondsPassed += 1;
        world.sendMessage("[TEST] Seconds passed since the last minute: " + secondsPassed);
        if (secondsPassed = 60) {
            let secondsPassed = 0;
            minutesPassed += 1;
            world.sendMessage("[TEST] Minutes Passed since the last hour: " + minutesPassed);
        }
        if (minutesPassed == 60) {
            let minutesPassed = 0;
            hoursPassed += 1;
            world.sendMessage("Hours Passed: " + hoursPassed);
        }
        system.run(mainTick());
    }
}