while ($true) {
    $response = curl.exe -sk https://www.bredbandskollen.se -w "%{time_total} %{http_code}\n" -o NUL
    $time = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
    $parts = $response -split ' '
    $totalTime = "{0:N1}" -f [double]$parts[0]  # round to 1 decimal place
    $httpCode = $parts[1]
    Write-Output "$time $totalTime s $httpCode"
    Start-Sleep -Seconds 1
}

while ($true) {
    $response = curl.exe -sk https://www.bredbandskollen.se -w "%{time_total} %{http_code}`n" -o NUL
    $time = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
    $parts = $response.Trim() -split ' '
    $totalTime = "{0:N1}" -f [double]$parts[0]
    $httpCode = $parts[1]
    "$time $totalTime s $httpCode" | Tee-Object -FilePath "curl_log.txt" -Append
    Start-Sleep -Seconds 1
}

$date = Get-Date -Format "yyyyMMdd_HHmmss"
$logFile = "curl_log_$date.txt"
while ($true) {
    $response = curl.exe -sk https://www.bredbandskollen.se -w "%{time_total} %{http_code}`n" -o NUL
    $time = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
    $parts = $response.Trim() -split ' '
    $totalTime = "{0:N1}" -f [double]$parts[0]
    $httpCode = $parts[1]
    "$time $totalTime s $httpCode" | Tee-Object -FilePath $logFile -Append
    Start-Sleep -Seconds 1
}
