RE: [Evolution] Islamic Calendar Support File (Progress!)
- From: "Ray Lee" <ray madrabbit org>
- To: "Ali Abdin" <aliabdin aucegypt edu>, <evolution helixcode com>
- Subject: RE: [Evolution] Islamic Calendar Support File (Progress!)
- Date: Mon, 24 Apr 2000 20:40:56 -0700
== I, and > == Ali Abdin wrote:
I create the time_t in the first place by /using/ the tm structure.
So basically, to create a 'tm' structure from an Islamic date
should be very simple.
Okay, cool.
True - but I don't think the calendar-client code is set-up for
this well (i.e. i don't think it was designed to allow it to work
with two different calendar formats). So that may take some work.
Agreed, but as soon as you need to deal with two of something, it's just
as easy to deal with a dozen. So this might be a good time to take a quick
peek at the Chinese, Hindu, and other calendars to see what they may need
in terms of support for dates and years, and then find something nice and
abstract that can wrap all of them.
last_day_of_gregorian_month tells you the number of days (or
'size') of the month. I fail to see how time and/or mktime will help
me in that.
Well, then I'm just not being very clear. Look at this instead, and maybe
it'll explain what I'm trying to say:
[ray ~]$ cat days.c
#include <stdio.h>
#include <time.h>
int main(int argc, char *argv[]) {
struct tm tm;
char buff[10];
int i;
for (i=1;i<=12;i++) {
memset(&tm,0,sizeof tm);
tm.tm_year=atoi(argv[1])-1900;
tm.tm_mon=i;
tm.tm_mday=0; // 1 is first day, so 0=day before
mktime(&tm); // now the fields are correct
strftime(buff,sizeof buff, "%b %d",&tm);
printf("%s ",buff);
if (i%6==0) printf("\n");
}
}
[ray ~]$ ./days 2000
Jan 31 Feb 29 Mar 31 Apr 30 May 31 Jun 30
Jul 31 Aug 31 Sep 30 Oct 31 Nov 30 Dec 31
[ray ~]$ ./days 2001
Jan 31 Feb 28 Mar 31 Apr 30 May 31 Jun 30
Jul 31 Aug 31 Sep 30 Oct 31 Nov 30 Dec 31
[ray ~]$
(libc, getting the 2000 leap year problem right for years now...)
[Integration of different calendars into Evolution]
Or as above. (Find a nice split point in the code base, define an
interface, and populate most of the interface with the
existing routines.)
split point in the code base? sorry I do not understand.
To split the date representation code from the date display code. We don't
care how the date is represented internally, as long as it covers all the
dates and times we're interested in. However, we *do* care about how it's
displayed to the user. So the display code needs to be split away from the
date representation code, and an interface defined, such that any kind of
modern calendar can be used.
Ray Lee / ray madrabbit org ~ rblee impulse net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]