fixed a bug for when the next notification time is tomorrow
Security / security (push) Successful in 1m6s

This commit is contained in:
2026-05-13 21:21:06 -05:00
parent 998f639a55
commit adf42df4a7
+11 -1
View File
@@ -105,17 +105,27 @@ while ($true) {
}
Write-Host "Finding next notification time..."
$nextNotificationTomorrow = $true
foreach($time in $notificationTimes)
{
$now = Get-Date
$diff = $now.Hour - $time
if ($diff -lt 0) # next notification time
{
$nextNotificationTomorrow = $false
Write-Host "Next notification time is $time`:00"
$sleepTime = ($diff * -1) * 60
$sleepTime = ($diff * -1) * 60 * 60 # hours * mins * seconds
Write-Host "Sleeping for $sleepTime seconds"
Start-Sleep -Seconds $sleepTime
continue # leave loop
}
}
if ($nextNotificationTomorrow)
{
Write-Host "Next notification time is $time`:00"
$diff = 24 - $now.Hour + $notificationTimes[0]
$sleepTime = $diff * 60 * 60 # hours * mins * seconds
Write-Host "Sleeping for $sleepTime seconds"
Start-Sleep -Seconds $sleepTime
}
}