Theiling Online    Sitemap    Conlang Mailing List HQ   

Re: OT: CONCULTURE: Ayeri calendar again

From:Mark J. Reed <markjreed@...>
Date:Monday, January 10, 2005, 20:54
On Mon, Jan 10, 2005 at 06:20:28PM +0100, Carsten Becker wrote:
> Hey all, especially Mark J. Reed -- I need your help as a
Uh-oh, I've been singled out! The Powers know where I am! Guess it's time to pack up and change identities again . . . I only have a minute to respond right now, but if you need more help let me know and I'll revisit. :)
> > # Correspondence point > > $TIME_T_0 = 62772584; # UNIX time_t of correspondence > > # point => in days
> Why do we need to know this?
For calendar conversion, what you need is a known point of correspondence; some date in calendar A whose date in calendar B you already know. You not only need both dates, but you also need to know the relative lengths of the units, etc. Often, the conversion process is made simpler by use of a third calendar system to use as an intermediary, especially if this third calendar system is really gosh-darn simple, such as a monotonically increasing count in a single unit. For this reason, the Julian Day is a common choice; the emacs calendar system uses a similar system (absolute day count) with a different starting point (Jan 1, 1 CE Gregorian). This simplifies the math; plus, if you wish to convert among N calendar systems, you only need 2N sets of conversion formulae (from each calendar to the intermediary, and the reverse) instead of N^2. In PHP, as in many other programming languages which were born on UNIX, dates/times are natively manipulated in "time_t" form, which is effectively just such a third calendar system. Time zero is January 1st, 1970 at midnight UTC(=GMT) and you just count forward from there. The basic unit is the second, but it's easy to handle any unit that's always the same number of seconds (ignoring leap seconds), like microseconds, milliseconds, minutes, hours, days, or weeks. Just not months or years, because their size varies. So. Given a point in time whose date you know in both our calendar and the Ayeri's, it simplifies the conversion if you know the time_t value of that point. Which is easy to get from PHP if you know the date in the Gregorian calendar: <?php $time_t = gmmktime($hour, $minute, $second, $month, $day, $year); ?> In the earlier code I used days instead of seconds for two reason: 1. to keep the numbers to a more reasonable size 2. the day is the basic unit of most calendars <?php $time_t_days = gmmktime($hour, $minute, $second, $month, $day, $year)/86400.0; ?> -Mark