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ē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ōna";
} else {
$dtime="nighttime";
$kdtime="jas<sup>h</sup>ā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ēlen Time</span> <span class="links"><a
href="index.html"><img src="home.gif" alt="Home" /></a> <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ēlen planet of Tērjemār, it is:
</p>
<p><span class="kelen">jalit<sup>h</sup>a la ē <?= $kdtime ?> ī
anhōl<sup>j</sup>i <?= $holj8 ?> ī anūsri <?= $usre8 ?>
ī anūsīñi <?= $usin8 ?> ī
anīlīñi <?= $ilin8 ?> ē anlōni <?=
base_convert($nmorin,10,8) ?> il antielen ñi anrūni <?=
base_convert($cmorin,10,8) ?> ā mamōrīñ āe
anlōni <?= base_convert($nsiste,10,8) ?> il antielen ñi
anrūni <?= base_convert($csiste,10,8) ?> ā masīste āe
anlōni <?= base_convert($nsello,10,8) ?> il antielen ñi
anrūni <?= base_convert($csello,10,8) ?> ā masēllō
āe anlōni <?= base_convert($nloin,10,8) ?> il antielen ñi
anrūni <?= base_convert($cloin,10,8) ?> ā
malōīñ ē anlōni <?= $lonj8 ?> il antielen
ñi anrūsi <?= $year8 ?> ā malūāne
jamōlemae sū-kēie;</span></p>
<p>or:</p>
<p><span class="kelen">la ē <?= "$kdtime $holj8-$usre8-$usin8-
$ilin8" ?> ē <?= base_convert($nmorin,10,8) ?> jē
mamōrīñ <?= base_convert($cmorin,10,8) ?> āe <?=
base_convert($nsiste,10,8) ?> jē masīste <?=
base_convert($csiste,10,8) ?> āe <?= base_convert($nsello,10,8) ?>
jē masēllō <?= base_convert($csello,10,8) ?> āe <?=
base_convert($nloin,10,8) ?> jē malōīñ <?=
base_convert($cloin,10,8) ?> ē anlōni <?= $lonj8 ?> il antielen
anrūsi <?= $year8 ?>;</span></p>
<p>which translates to:</p>
<p>Today is the <?= $dtime ?> of <span class="kelen">anhōl<sup>j</
sup>i</span> <?= $holj ?> and <span class="kelen">anūsri</span> <?=
$usre ?> and <span class="kelen">anūsīñi</span> <?=
$usin ?> and <span class="kelen">anīlīñi</span> <?=
$ilin ?> on the <?= $nmorin . det_th($nmorin) ?> day after the
re-appearance of the <?= $cmorin . det_th($cmorin) ?> moon
Mōrīñ or the <?= $nsiste . det_th($nsiste) ?> day after
the re-appearance of the <?= $csiste . det_th($csiste) ?> moon Sīste
or the <?= $nsello . det_th($nsello) ?> day after the re-appearance of the
<?= $csello . det_th($csello) ?> moon Sēllō or the <?= $nloin .
det_th($nloin) ?> day after the re-appearance of the <?= $cloin .
det_th($cloin) ?> moon Lōīñ or the <?= $lonj .
det_th($lonj) ?> day after the <?= $year . det_th($year) ?> return of the
Womb of the Goddess Lūāne to the sky.</p>
<p>or:</p>
<p> It's <?= "$dtime $holj-$usre-$usin-$ilin" ?> of the <?= $nmorin .
det_th($nmorin) ?> of Mōrīñ <?= $cmorin ?> or the
<?= $nsiste . det_th($nsiste) ?> of Sīste <?= $csiste ?> or the <?=
$nsello . det_th($nsello) ?> of Sēllō <?= $csello ?> or the <?=
$nloin . det_th($nloin) ?> of Lōīñ <?= $cloin ?> in the
year <?= $year ?>.</p>
<p>Why are the numbers different in the translation? Because the
Kēleñi count in Base 8. See <a href="numbers.html">Counting in
Kēlen</a> for more detail.</p>
<p>On Earth, where we would use Hours:Minutes:Seconds, the
Kēleñi use <span class="kelen">jahōl<sup>j</sup>i</
span>-<span class="kelen">jūsri</span>-<span
class="kelen">jūsīñi</span>-<span
class="kelen">jīlīñi</span>. Starting with the smallest
measure, a <span class="kelen">jīlīñ</span> is
approximately equivalent to 1.5 Earth seconds. There are 64 <span
class="kelen">jīlīñi</span> in a <span
class="kelen">jūsīñ</span>, making 1 <span
class="kelen">jūsīñ</span> approximately equivalent to a
minute and a half. There are 12 <span
class="kelen">jūsīñi</span> in a <span
class="kelen">jūsre</span>, making a <span class="kelen">jūsre</
span> approximately equivalent to twenty minutes, a convenient division of
time. There are 8 <span class="kelen">jūsri</span> in a <span
class="kelen">jahōl<sup>j</sup>a</span>, making those approximately
equivalent to two and a half hours. There are 12 <span
class="kelen">jahōl<sup>j</sup>i</span> in a day, which starts at
sunrise. Since Tērjemār has little axial tilt, the day is always
more or less 6 <span class="kelen">jahōl<sup>j</sup>i</span> of light
and 6 of night.</p>
<p>Tērjemār has four moons: Lōīñ,
Sēllō,
Sīste, and Mōrīñ. Lōīñ is new
approximately every <?= $rloin ?> days; Sēllō approximately
every <?= $rsello ?> days; Sīste approximately every <?= $rsiste ?>
days; and Mōrīñ is new approximately every <?= $rmorin ?>
days. Since Lōīñ is new so often, it is not usually used
for telling the date, except that each new moon of Lōīñ
marks the end of a <span class="kelen">jas<sup>h</sup>ē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á;