<?php

    // This code is stupidly simple. If you can think of any
    // way to optimise it - let me know.

    // It basically just keeps track of 20 named "lights"
    // and turn them on or off depending on the time.

    function getcolors() {

       // I'd rather detect the time but how?
       date_default_timezone_set("Europe/London");

       $_minute = date("i",time()) + 0;
       $_hour = date("G",time()) + 0;
 
       $half = $ten1 = $a = $quarter = $twenty = $five1 = $minutes = $to = $past = $one = $three = $two = $four = $five2 = $six = $seven = $eight = $nine = $ten2 = $eleven = $twelve = $oclock = "#555555";

       if ($_minute >= 5 && $_minute < 10) {
           $five1 = $past = "#FFFFFF";
       } elseif ($_minute < 5) {
           $oclock = "#FFFFFF";
       } elseif ($_minute >= 10 && $_minute < 15) {
           $ten1  = $past = "#FFFFFF";
       } elseif ($_minute >= 15 && $_minute < 20) {
           $a = $quarter = $past = "#FFFFFF";
       } elseif ($_minute >= 20 && $_minute < 25) {
           $twenty = $past = "#FFFFFF";
       } elseif ($_minute >= 25 && $_minute < 30) {
           $twenty = $five1 = $past = "#FFFFFF";
       } elseif ($_minute >= 30 && $_minute < 35) {
           $half = $past = "#FFFFFF";
       } elseif ($_minute >= 35 && $_minute < 40) {
           $_hour++;
           $twenty = $five1 = $to = "#FFFFFF";
       } elseif ($_minute >= 40 && $_minute < 45) {
           $_hour++;
           $twenty = $to = "#FFFFFF";
       } elseif ($_minute >= 45 && $_minute < 50) {
           $_hour++;
           $a = $quarter = $to = "#FFFFFF";
       } elseif ($_minute >= 50 && $_minute < 55) {
           $_hour++;
           $ten1 = $to = "#FFFFFF";
       } elseif ($_minute >= 55 && $_minute < 60) {
           $_hour++;
           $five1 = $to = "#FFFFFF";
       }

       if ($_hour == 24) {$_hour=0;}

       if ($_hour == 1 || $_hour == 13) {$one = "#FFFFFF";}
       if ($_hour == 2 || $_hour == 14) {$two = "#FFFFFF";}
       if ($_hour == 3 || $_hour == 15) {$three = "#FFFFFF";}
       if ($_hour == 4 || $_hour == 16) {$four = "#FFFFFF";}
       if ($_hour == 5 || $_hour == 17) {$five2 = "#FFFFFF";}
       if ($_hour == 6 || $_hour == 18) {$six = "#FFFFFF";}
       if ($_hour == 7 || $_hour == 19) {$seven = "#FFFFFF";}
       if ($_hour == 8 || $_hour == 20) {$eight = "#FFFFFF";}
       if ($_hour == 9 || $_hour == 21) {$nine = "#FFFFFF";}
       if ($_hour == 10 || $_hour == 22) {$ten2 = "#FFFFFF";}
       if ($_hour == 11 || $_hour == 23) {$eleven = "#FFFFFF";}
       if ($_hour == 12 || $_hour == 0) {$twelve = "#FFFFFF";}

       echo "#half    {color: $half;}\n #a       {color: $a;}\n #ten1    {color: $ten1;}\n #quarter {color: $quarter;}\n #twenty  {color: $twenty;}\n #five1    {color: $five1;}\n #minutes {color: $minutes;}\n #to      {color: $to;}\n #past    {color: $past;}\n #one     {color: $one;}\n #three   {color: $three;}\n #two     {color: $two;}\n #four    {color: $four;}\n #five2    {color: $five2;}\n #six     {color: $six;}\n #seven   {color: $seven;}\n #eight   {color: $eight;}\n #nine    {color: $nine;}\n #ten2     {color: $ten2;}\n #eleven  {color: $eleven;}\n #twelve  {color: $twelve;}\n #oclock  {color: $oclock;}\n";

   }
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Time and Relative Dimension in Space</title>
<META HTTP-EQUIV="REFRESH" CONTENT="60">
<meta name="author" content="Chris Funderburg" />

<style>
   body {background-color: #323A45;
         color: #FFFFFF;
         text-shadow: 3px 3px #000000;
         font-size: 500%;
         text-align: justify;
        }
   span {color: #00C2C2;}
   a {color: #00C2C2;}

   #itis    {color: #FFFFFF;}
   #license {font-size: 18%;
             position: fixed;
             color: #00C2C2;
             bottom: 5px;
             left: 5px;
             text-shadow: 0px 0px #000000;
            }

   <?php getcolors(); ?>
</style>

</head>

<body>
<span id="itis">IT IS </span>
<span id="half">HALF </span>
<span id="a">A </span>
<span id="ten1">TEN </span>
<span id="quarter">QUARTER </span>
<span id="twenty">TWENTY </span>
<span id="five1">FIVE </span>
<span id="minutes">MINUTES </span>
<span id="to">TO </span>
<span id="past">PAST </span>

<span id="eight">EIGHT </span>
<span id="two">TWO </span>
<span id="four">FOUR </span>
<span id="nine">NINE </span>
<span id="one">ONE </span>
<span id="three">THREE </span>
<span id="seven">SEVEN </span>
<span id="twelve">TWELVE </span>
<span id="five2">FIVE </span>
<span id="eleven">ELEVEN </span>
<span id="six">SIX </span>
<span id="ten2">TEN </span>

<span id="oclock">OCLOCK </span>

<span id=license>This <span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/Text" rel="dct:type">clock</span> was written by <a href="http://chris.funderburg.me/" property="cc:attributionName" rel="cc:attributionURL">Chris Funderburg</a> and the <a href="timesource.php">code behind this page</a> is licensed with the <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html#SEC1">GNU General Public License - v2.</a></span>

</body>
</html>