diff --git a/src/Models/Attributes/Timestamp.php b/src/Models/Attributes/Timestamp.php index 4046eb71..d03e106d 100644 --- a/src/Models/Attributes/Timestamp.php +++ b/src/Models/Attributes/Timestamp.php @@ -190,7 +190,7 @@ protected function convertWindowsIntegerTimeToDateTime(string|int|null $value = } return (new DateTime)->setTimestamp( - (int) ($value / 10000000) - 11644473600 + (int) (round($value / 10000000) - 11644473600) ); } diff --git a/tests/Unit/Models/Attributes/TimestampTest.php b/tests/Unit/Models/Attributes/TimestampTest.php index c852437a..a0678c10 100644 --- a/tests/Unit/Models/Attributes/TimestampTest.php +++ b/tests/Unit/Models/Attributes/TimestampTest.php @@ -154,7 +154,7 @@ public function test_windows_int_type_rounds_correctly() foreach (['133692539995000000', '133692539999500000'] as $windowsIntegerTime) { $dateTime = $timestamp->toDateTime($windowsIntegerTime); - $expectedUnixTimestamp = (int) ($windowsIntegerTime / 10000000) - 11644473600; + $expectedUnixTimestamp = (int) (round($windowsIntegerTime / 10000000) - 11644473600); $this->assertEquals($expectedUnixTimestamp, $dateTime->getTimestamp()); }