Theiling Online    Sitemap    Conlang Mailing List HQ   

Re: Programming a calendar system

From:Carsten Becker <post@...>
Date:Wednesday, April 28, 2004, 19:48
Well, that's how far I've come. Sorry for HTML ... btw, I'm writing this
in Mozilla Firebird, just for testing purposes.

------------------------------------------------------------------------

<?php

    # Get the time as a unix date stamp in seconds
    $secs = time();

    # Aréqan seconds are 1.2 Earth seconds long, $asecs is rounded to
make it easier
    $asecs = floor($secs/1.2);

    # 72 seconds are 1 minute
    $amin      = $asecs/72;  # How many complete minutes now?
    $aminrest  = $asecs%72;  # How many seconds left?

    # 18 minutes are 1 hour
    $ahour     = $amin/18;  # How many complete hours now?
    $ahourrest = $amin%18;  # How many minutes left?

    # 27 hours are 1 day
    $aday      = $ahour/27;  # How many complete days now?
    $adayrest  = $ahour%27;  # How many minutes left?

    # 456,25(!) days are 1 year
    $Ayear     = 456.25;
    $ayear     = $aday/$Ayear;
    $ayearrest = $aday%$Ayear;

    /*  Now we've got the time, but what about the date?
        First, we must see how many complete years have passed since
        'The day 0', which is August 26, -986, 10:18pm (my birthday,
just -1000 years)
            => Every 4th year -1 day in 9th month! The days of the week
count on as usual.
        Then we must see from the modulo how many complete months have
passed
            => Months are not of equal length!!!
        By the modulo, we receive the day of the month.
        How to get the day of the week I have no idea.
    */

    if($adayrest < 10) {
        echo "0".$adayrest.":".$ahourrest.":".$aminrest;
    } elseif ($ahourrest < 10) {
        echo $adayrest.":0".$ahourrest.":".$aminrest;
    } elseif ($aminrest < 10) {
        echo $adayrest.":".$ahourrest.":0".$aminrest;
    } else {
        echo $adayrest.":".$ahourrest.":".$aminrest;
    }

?>

------------------------------------------------------------------------

Now what about those questions in the comment?

Thanks,
Carsten

Reply

Mark J. Reed <markjreed@...>