Theiling Online    Sitemap    Conlang Mailing List HQ   

Re: Programming a calendar system (WAS: Re: I Should've Been ...)

From:Sylvia Sotomayor <kelen@...>
Date:Sunday, April 25, 2004, 20:50
On Sunday 25 April 2004 09:31 am, Roger Mills wrote:
> Carsten Becker wrote: > > Hello! > > > > Yay! Concalendaring ... I've got a question about manipulating the > > calendar functions of programming languages, but first my concalendar, > > then my problem: > > > > 456,25 days :: 18 months :: 25 1/3 days > > > > >> 18*25,33333 = 456 days :: 0,25 days left per year > > > > 27 h/day :: 18 min/h :: 72 sec/min > > This is not unlike the system on Cindu (Kash lang.)-- 464 days, 16 mos > of 29 days each. (No allowance for leap years-- there probably should > be....but nothing is perfect!) However the Cindu day = 25 hrs. 18mins > in our time (so the Cindu year is actually 489 Earth days IIRC-- 1.34). > I can convert from one to the other, but it ain't easy for one who is > math-challenged, and I'm never sure the answer is correct....:-((( > See: http://cinduworld.tripod.com/kashdatetime.htm > > > Now my question: How can you tell PHP to make this? The year has not > > 365 days but 456 days, that's the problem. If it's too much off-topic, > > we could discuss this off-list as well. > > I would like to be included in the discussion, too. Thanks, Roger
OK, Here's the PHP for the Kelen calendar. This page isn't yet up on the WWW. I start by converting the seconds. Kelen seconds are ~1.5 Earth seconds. There's an older version of this (sans moons and with a different year length) at http://www.qistech.com/KCAL The old version is in javascript and has frames. ---- begin file ---- <?php print('<?xml version="1.0" encoding="UTF-8"?>'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/ xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <link rel="stylesheet" type="text/css" href="screen.css" media="screen" /> <link rel="shortcut icon" href="emerald.ico" /> <link rel="stylesheet" type="text/css" href="print.css" media="print" /> <title>K&#275;len Time</title> <?php #Get the time as a unix date stamp in seconds $secs = time(); #Kelen seconds are ~1.5 Earth seconds long, rounded down so as to make the math easier $ksecs = floor($secs/1.5); #64 Kelen seconds (ilin) make up an usin. $kusn = $ksecs/64; $ilin = $ksecs%64; #12 usin make up an usren. $kusr = $kusn/12; $usin = $kusn%12; #8 usren make up a holja. $khol = $kusr/8; $usre = $kusr%8; #and 12 holja make up a Kelen day (lonja). $klon = $khol/12; $holj = $khol%12; #Our planet is arbitrarily 1.45 au's away from a F8 star $krev = round(sqrt(pow(1.45,3))*(365.24*24*60*60))/(1.5*64*12*8*12); $kyr = $klon/$krev; $lonj = $klon%$krev; #Since in unix, the second count began on Jan 1, 1970, #we will add an arbitrary 940 revolutions to the year. #And we'll floor it to see which year we're in. $year = floor(940 + $kyr); #Determining whether it is day or night if ($holj<6) { $dtime="daytime"; $kdtime="jal&#333;na"; } else { $dtime="nighttime"; $kdtime="jas<sup>h</sup>&#257;el"; } #Converting ilin, usin, usren, holja, lonja, and the year into base 8. $ilin8=base_convert($ilin,10,8); $usin8=base_convert($usin,10,8); $usre8=base_convert($usre,10,8); $holj8=base_convert($holj,10,8); $lonj8=base_convert($lonj,10,8); $year8=base_convert($year,10,8); #A function! If the number is not between 4 & 20, determine the ordinal suffix function det_th($num) { if (20>($num%100) AND ($num%100)>4) { $th="th"; } else { $num=$num%10; if ($num==1) { $th="st"; } elseif ($num==2) { $th="nd"; } elseif ($num==3) { $th="rd"; } else { $th="th"; } } return $th; } #And if the above wasn't complicated enough, we got to have 4 moons! #This little piece of math determines a moon's revolution in Kelen days #of 73728 'seconds' apiece. function rev_time($rdays) { $moon = (((sqrt(pow($rdays,3)/0.9)*1.4)*3600)/1.5)/73728; return $moon; } #The first moon, loinja, is arbitrarily 48 radii from the planet. $loin = rev_time(48); #The second moon, sello, is arbitrarily 61 radii from the planet. $sello = rev_time(61); #The third moon, siste, is arbitrarily 77 radii from the planet. $siste = rev_time(77); #The fourth moon, morinja, is arbitrarily 98 radii from the planet. $morin = rev_time(98); #Let's round these to the nearest whole number so we can discuss them later. $rloin = round($loin); $rsello = round($sello); $rsiste = round($siste); $rmorin = round($morin); #How many days has it been since the millenium started, anyway: $kdays = ($year*$krev)+$lonj; #Determining how many days since the last new moon $nloin=$kdays%$loin; $nsello=$kdays%$sello; $nsiste=$kdays%$siste; $nmorin=$kdays%$morin; #Now, to determine how many new moons since the milleniun started: $cloin=$kdays/$loin; $csello=$kdays/$sello; $csiste=$kdays/$siste; $cmorin=$kdays/$morin; #which is a useless figure. What we really want is how many new moons since the start of the year. $cloin=round($cloin)-round(($year*$krev)/$loin); $csello=round($csello)-round(($year*$krev)/$sello); $csiste=round($csiste)-round(($year*$krev)/$siste); $cmorin=round($cmorin)-round(($year*$krev)/$morin); ?> </head> <body> <div class="header"> <span class="title">K&#275;len Time</span> <span class="links"><a href="index.html"><img src="home.gif" alt="Home" /></a> &nbsp; <a href="http://www.qistech.com/KOP"><img src="dict.gif" alt="Dictionary" /
></a></span>
</div> <div class="main"> <p> Right now on Earth, it's <?php echo Gmdate("l, F j, Y, H:i:s"); ?> Greenwich Mean Time. On the K&#275;len planet of T&#275;rjem&#257;r, it is: </p> <p><span class="kelen">jalit<sup>h</sup>a la &#275; <?= $kdtime ?> &#299; anh&#333;l<sup>j</sup>i <?= $holj8 ?> &#299; an&#363;sri <?= $usre8 ?> &#299; an&#363;s&#299;&ntilde;i <?= $usin8 ?> &#299; an&#299;l&#299;&ntilde;i <?= $ilin8 ?> &#275; anl&#333;ni <?= base_convert($nmorin,10,8) ?> il antielen &ntilde;i anr&#363;ni <?= base_convert($cmorin,10,8) ?> &#257; mam&#333;r&#299;&ntilde; &#257;e anl&#333;ni <?= base_convert($nsiste,10,8) ?> il antielen &ntilde;i anr&#363;ni <?= base_convert($csiste,10,8) ?> &#257; mas&#299;ste &#257;e anl&#333;ni <?= base_convert($nsello,10,8) ?> il antielen &ntilde;i anr&#363;ni <?= base_convert($csello,10,8) ?> &#257; mas&#275;ll&#333; &#257;e anl&#333;ni <?= base_convert($nloin,10,8) ?> il antielen &ntilde;i anr&#363;ni <?= base_convert($cloin,10,8) ?> &#257; mal&#333;&#299;&ntilde; &#275; anl&#333;ni <?= $lonj8 ?> il antielen &ntilde;i anr&#363;si <?= $year8 ?> &#257; mal&#363;&#257;ne jam&#333;lemae s&#363;-k&#275;ie;</span></p> <p>or:</p> <p><span class="kelen">la &#275; <?= "$kdtime $holj8-$usre8-$usin8- $ilin8" ?> &#275; <?= base_convert($nmorin,10,8) ?> j&#275; mam&#333;r&#299;&ntilde; <?= base_convert($cmorin,10,8) ?> &#257;e <?= base_convert($nsiste,10,8) ?> j&#275; mas&#299;ste <?= base_convert($csiste,10,8) ?> &#257;e <?= base_convert($nsello,10,8) ?> j&#275; mas&#275;ll&#333; <?= base_convert($csello,10,8) ?> &#257;e <?= base_convert($nloin,10,8) ?> j&#275; mal&#333;&#299;&ntilde; <?= base_convert($cloin,10,8) ?> &#275; anl&#333;ni <?= $lonj8 ?> il antielen anr&#363;si <?= $year8 ?>;</span></p> <p>which translates to:</p> <p>Today is the <?= $dtime ?> of <span class="kelen">anh&#333;l<sup>j</ sup>i</span> <?= $holj ?> and <span class="kelen">an&#363;sri</span> <?= $usre ?> and <span class="kelen">an&#363;s&#299;&ntilde;i</span> <?= $usin ?> and <span class="kelen">an&#299;l&#299;&ntilde;i</span> <?= $ilin ?> on the <?= $nmorin . det_th($nmorin) ?> day after the re-appearance of the <?= $cmorin . det_th($cmorin) ?> moon M&#333;r&#299;&ntilde; or the <?= $nsiste . det_th($nsiste) ?> day after the re-appearance of the <?= $csiste . det_th($csiste) ?> moon S&#299;ste or the <?= $nsello . det_th($nsello) ?> day after the re-appearance of the <?= $csello . det_th($csello) ?> moon S&#275;ll&#333; or the <?= $nloin . det_th($nloin) ?> day after the re-appearance of the <?= $cloin . det_th($cloin) ?> moon L&#333;&#299;&ntilde; or the <?= $lonj . det_th($lonj) ?> day after the <?= $year . det_th($year) ?> return of the Womb of the Goddess L&#363;&#257;ne to the sky.</p> <p>or:</p> <p> It's <?= "$dtime $holj-$usre-$usin-$ilin" ?> of the <?= $nmorin . det_th($nmorin) ?> of M&#333;r&#299;&ntilde; <?= $cmorin ?> or the <?= $nsiste . det_th($nsiste) ?> of S&#299;ste <?= $csiste ?> or the <?= $nsello . det_th($nsello) ?> of S&#275;ll&#333; <?= $csello ?> or the <?= $nloin . det_th($nloin) ?> of L&#333;&#299;&ntilde; <?= $cloin ?> in the year <?= $year ?>.</p> <p>Why are the numbers different in the translation? Because the K&#275;le&ntilde;i count in Base 8. See <a href="numbers.html">Counting in K&#275;len</a> for more detail.</p> <p>On Earth, where we would use Hours:Minutes:Seconds, the K&#275;le&ntilde;i use <span class="kelen">jah&#333;l<sup>j</sup>i</ span>-<span class="kelen">j&#363;sri</span>-<span class="kelen">j&#363;s&#299;&ntilde;i</span>-<span class="kelen">j&#299;l&#299;&ntilde;i</span>. Starting with the smallest measure, a <span class="kelen">j&#299;l&#299;&ntilde;</span> is approximately equivalent to 1.5 Earth seconds. There are 64 <span class="kelen">j&#299;l&#299;&ntilde;i</span> in a <span class="kelen">j&#363;s&#299;&ntilde;</span>, making 1 <span class="kelen">j&#363;s&#299;&ntilde;</span> approximately equivalent to a minute and a half. There are 12 <span class="kelen">j&#363;s&#299;&ntilde;i</span> in a <span class="kelen">j&#363;sre</span>, making a <span class="kelen">j&#363;sre</ span> approximately equivalent to twenty minutes, a convenient division of time. There are 8 <span class="kelen">j&#363;sri</span> in a <span class="kelen">jah&#333;l<sup>j</sup>a</span>, making those approximately equivalent to two and a half hours. There are 12 <span class="kelen">jah&#333;l<sup>j</sup>i</span> in a day, which starts at sunrise. Since T&#275;rjem&#257;r has little axial tilt, the day is always more or less 6 <span class="kelen">jah&#333;l<sup>j</sup>i</span> of light and 6 of night.</p> <p>T&#275;rjem&#257;r has four moons: L&#333;&#299;&ntilde;, S&#275;ll&#333;, S&#299;ste, and M&#333;r&#299;&ntilde;. L&#333;&#299;&ntilde; is new approximately every <?= $rloin ?> days; S&#275;ll&#333; approximately every <?= $rsello ?> days; S&#299;ste approximately every <?= $rsiste ?> days; and M&#333;r&#299;&ntilde; is new approximately every <?= $rmorin ?> days. Since L&#333;&#299;&ntilde; is new so often, it is not usually used for telling the date, except that each new moon of L&#333;&#299;&ntilde; marks the end of a <span class="kelen">jas<sup>h</sup>&#275;loru</span>, the psychological equivalent of a week. The other three moons are often cited, in reverse order.</p> </div> </body> </html> ---- end file ---- Holler if you have questions. -- Sylvia Sotomayor sylvia1@ix.netcom.com kelen@ix.netcom.com Kélen language info can be found at: http://home.netcom.com/~sylvia1/Kelen/kelen.html This post may contain the following: á (a-acute) é (e-acute) í (i-acute) ó (o-acute) ú (u-acute) ñ (n-tilde) áe ñarra anmárienne cí áe reharra anmárienne lá;