Create a gist now

Instantly share code, notes, and snippets.

<?php
// Get solar minutes for seconds.
function solar($seconds) {
$leap = 365.25 / 365;
$inSeconds = $seconds * $leap;
$inMinutes = $inSeconds / 60;
return round($inMinutes);
}
// Get clock minutes for seconds.
function clock($seconds) {
$inSeconds = $seconds;
$inMinutes = $inSeconds / 60;
return round($inMinutes);
}
// Get length of solar/clock sync.
function getSync() {
$sec = 1;
while (solar($sec) == clock($sec)) {
$sec += 1;
}
return $sec;
}
$seconds = getSync();
$minutes = floor($seconds / 60);
echo "In sync for:" . PHP_EOL;
echo "- $seconds seconds" . PHP_EOL;
echo "- $minutes minutes" . PHP_EOL;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment