<?php

declare(strict_types=1);

namespace App\Framework\DateTime;

use App\Framework\Core\ValueObjects\Duration;

use function usleep;

final readonly class SystemTimer implements Timer
{
    public function sleep(Duration $duration): void
    {
        // Convert to microseconds for maximum precision
        $microseconds = (int) round($duration->toMicroseconds());
        usleep($microseconds);
    }
}
