Skip to content

Commit

Permalink
Run no microseconds calculation before PHP 7.1 (#1507)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls authored Nov 13, 2018
1 parent 6689b51 commit 3b903d2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Carbon/Carbon.php
Original file line number Diff line number Diff line change
Expand Up @@ -3976,7 +3976,13 @@ public function diffInSeconds($date = null, $absolute = true)
$value = $diff->days * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE +
$diff->h * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE +
$diff->i * static::SECONDS_PER_MINUTE +
$diff->s - (property_exists($diff, 'f') && $diff->f < 0 ? 1 : 0);
$diff->s - (
version_compare(PHP_VERSION, '7.1.0-dev', '>=') &&
property_exists($diff, 'f') &&
$diff->f < 0
? 1
: 0
);

return $absolute || !$diff->invert ? $value : -$value;
}
Expand Down

0 comments on commit 3b903d2

Please sign in to comment.