Skip to content

Instantly share code, notes, and snippets.

@SemanticallyNull
Created December 9, 2013 01:30
Show Gist options
  • Save SemanticallyNull/7866179 to your computer and use it in GitHub Desktop.
Save SemanticallyNull/7866179 to your computer and use it in GitHub Desktop.
<?php
date_default_timezone_set('Europe/Dublin');
// SET ME TO THE BASE YOU WANT
const BASE = 8;
function o($v) {
$u = floor(pow(60, 1/BASE));
for($i=$u;$i>=0;$i--) {
$set = false;
$vn = pow(BASE,$i);
for($y=(BASE-1);$y>=1;$y--) {
if($v >= $vn*$y) {
echo $y;
$set = true;
$v -= ($vn*$y);
}
}
if(!$set) { echo "0"; }
}
echo "\n";
}
if(BASE > 10) { die('Sorry, I can\'t handle big bases'); }
while(true){
$now = new DateTime();
echo "H:\t";o($now->format("h"));
echo "M:\t";o($now->format("i"));
echo "S:\t";o($now->format("s"));
echo "\033[3A";
usleep(500000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment