"); }; function cdate($seconds) { # This function accepts a Gregorian date and outputs an array with the numerical # description of the Constainian date: year, month, day, hour, second. $dl=96375; $cl=1542000; # 16 days $yl=40254199.125; # 26 cycles plus witchingday. $hl=3481.37; # standard "hour" length - 13, lunch (d*1.683), 13. $ml=217.58; # standard "minute" length. $seconds=$seconds + 149649924579.750; # Offset. Gregorian second is $common second Constainian. This is for calibration. # Calibration date: December 16, 2001 14:45 was New Year's (1 Bulc) 5286, second 0. $date[year]=floor($seconds/$yl); $left=($seconds - $yl * $date[year]); if ($left > ($cl * 13 + $dl * 1.683)) { # must be past the cusp. $safter = ($left - ($dl * 1.683)); $date[cycle] = floor($safter / $cl); $left = $left - $date[cycle] * $cl - $dl * 1.683; } else if ($left > ($cl * 13)) { # must be in the cusp. $date[cycle] = -1; $left=($left - ($cl * 13 + $dl * 1.683)); } else { # must be before the cusp $date[cycle] = floor($left / $cl); $left=($left - ($date[cycle] * $cl)); }; if ($date[cycle] > -1) $date[cycle]=$date[cycle]+1; $date[day]=floor($left / $dl); $left=($left - $date[day]*$dl); if ($left > ($hl * 13 + $hl * 1.683)) { # we are past the cusp. $safter = ($left - ($hl * 1.683)); $date[hour] = floor($safter / $hl); $left = $left - $date[hour] * $hl - $hl * 1.683; } else if ($left > ($cl * 13)) { # must be in the cusp. $date[hour] = -1; $left=($left - ($hl * 13 + $hl * 1.683)); } else { # must be before the cusp $date[hour] = floor($left / $hl); $left=($left - ($date[hour] * $hl)); }; if ($date[hour] > -1) $date[hour]=$date[hour]+1; $date[minute]=floor($left/$ml); $left=($left - $date[minute]*$ml); // $date[hour]=floor($left / $hl); // $left=($left - $date[hour]*$hl); switch ($date[day]) { case -1: $date[nameday]=Cusp; break; case 0: $date[nameday]=Bulc; break; case 1: $date[nameday]=Ecam; break; case 2: $date[nameday]=Remmah; break; case 3: $date[nameday]=Exan; break; case 4: $date[nameday]=Revaelc; break; case 5: $date[nameday]=Efin; break; case 6: $date[nameday]=Reggad; break; case 7: $date[nameday]=Kird; break; case 8: $date[nameday]=Drows; break; case 9: $date[nameday]=Ekip; break; case 10: $date[nameday]=Reipar; break; case 11: $date[nameday]=Relkcub; break; case 12: $date[nameday]=Anatak; break; case 13: $date[nameday]=Erbas; break; case 14: $date[nameday]=Nug; break; case 15: $date[nameday]=Walc; break; }; $date[second]=floor($left); return $date; } print("