I've been hacking away on Islamic Calendar support and I have achieved some results. Attached to this mail you should fine a cal-islamic.c file (only 8K). It is a 'small program' (that depends on gnome) - but the important aspects of it are the functions. The major things it does so far: 1) Gives the number of days since 1/1/1970 given an islamic date 2) Gives the islamic date given the number of days since 1/1/1970 (the former two should never be used 'publicly' the following two functions depend on the former though) 3) Gives the islamic date given a time_t 4) Gives the time_t given an islamic date Some things that I plan to do are as follows: 1) Clean it up to the GNOME 'C' style (I was told by Russel Steinthal that I should do this) 2) Create an 'IslamicDate' type so we only pass one variable around as opposed to 3 (day, month, year) 3) Once (if?) integrated into evolution, there are several functions that could be removed as they are already located in cal-utils stuff 4) There needs to be some sort of 'error' checking There is some stuff that I need comments on though: - How should the 'error' checking be done? For example - the mktime() function returns '-1' as an error, even though that is a VALID time_t (1 second before 1/1/1970) - Should the functions be in the month/day/year arg formats? (Personally, I prefer and use the day/month/year - but most of you are US-oriented people and as far as I know the US uses month/day/year) - How should this be integrated into Evolution? Russel Steinthal suggested that we have some sort of 'libcalformats' library for "other" calendar formats. - Someone told me on IRC that it doesn't make sense to get time_t's from a a date. This made sense to me. i.e. Once the EvolutionTime (For timezone's) is done - Either I, or somebody else will need to integrate it (so the islamic -> time_t and vice versa will take time into account). - Finally, it was discussed earlier that a 'different' calendar format should just be a different 'view' (in the MVC model). In other words the Islamic calendar should just be another 'client'. I've been thinking about this and I do not think this is the way to go. It would involve an AWFUL lot of code duplication. All that we really need though is to be able to 'customize' the month/day names and be able to 'set the days per month' (Islamic and Gregrorian both have 12 months per year). Then all we would need to 'add' is the ability to 'toggle' between the views and an extra 'dialog' to schedule Islamic events. I would appreciate any comments. I'd like this to go into Evolution CVS but I can't just create a 'diff -u' because I have no clue /how/ this would integrate into Evolution (i.e. its own separate library? into the server? client?) - So if the 'calendar' people working on Evolution could advise me on this, perhaps I could start working on some sort of patch. Thanks in advance, Ali Abdin
Attachment:
cal-islamic.c
Description: Text document