From 1c9692bc863ce3cfe3ae86ec126f3553e282c642 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 16 Aug 2026 15:07:07 +0200 Subject: [PATCH] fix using timeout periods above a minute --- CHANGELOG.md | 1 + src/Internal/Watch/Sync.php | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b6ee68..8eb32c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Deleting a link pointing to a directory now delete the link instead of the directory content - Flagging a stream as blocking was set as non-blocking +- Timeout periods above the minute were not taking into account ## 4.1.2 - 2026-08-01 diff --git a/src/Internal/Watch/Sync.php b/src/Internal/Watch/Sync.php index 75831e7..e3eabaa 100644 --- a/src/Internal/Watch/Sync.php +++ b/src/Internal/Watch/Sync.php @@ -237,9 +237,19 @@ public function clear(): self */ private static function timeout(Period $timeout): array { + $minute = 60; + $hour = 60* $minute; + $day = 24 * $hour; + $year = 365 * $day; + $seconds = $timeout->seconds(); $microseconds = ($timeout->milliseconds() * 1_000) + $timeout->microseconds(); + $seconds += $timeout->minutes() * $minute; + $seconds += $timeout->hours() * $hour; + $seconds += $timeout->days() * $day; + $seconds += $timeout->years() * $year; + return [$seconds, $microseconds]; } }