Created
April 7, 2013 20:18
-
-
Save Phally/5332307 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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