Salam Ahmed, 2008/2/14, أحمد المحمودي <[EMAIL PROTECTED]>: > I have been doing some research about the possibility of adding hijri > calendar directly into glibc. > I found that glibc does support other calendars, such as Buddhist Era > (using in Thailand, and Laos I think) and the Japanese Emperors' > reigns. > > That is done by adding definitions for era, era_d_t_fmt, era_d_fmt, > era_t_fmt, and alt_digits in the locale [1]. > > Those definitions modify the behaviour of some time functions (such as > strftime) when E and O modifiers are used [2]. > > The format of 'era' consists of semicolon-separated strings. Each > string shall be an era description segment with the format: > > direction:offset:start_date:end_date:era_name:era_format > > The descriptions for each field are in [1]. > > Now the problem is that supported calendars are those which are based > on Gregorian calendar. In [3] it says: > > The E modifier supports alternative date formats, such as the Japanese > Emperor's Era, as long as these are based on the Gregorian calendar > system. Extending the E modifiers to other date elements may provide > an implementation-defined extension capable of supporting other > calendar systems, especially in combination with the O modifier. > > So, I was thinking, that this 'era' can be used for Hijri as follows: > > 1. For countries that formally use Hijri system, we can add an 'era' > definition in their respective locale files. The era field that > matters now is 'era_name'. It can be something like "A.H." or even > "ه". > > 2. In glibc C code: a conversion function from Gregorian to Hijri can > be added, I was thinking of using the conversion functions that > implement the Um-Ul-Qura algorithm since, as far as I know, this is > the algorithm that is formally used in Arabia. > > 3. Somewhere in glibc's time/strftime_l.c & time/strptime_l.c [4], the > code should check if era_name is "A.H" or "ه", if that is true, it > will call for the conversion function to get the appropriate Hijri > date. > > I hope to get your comments on this suggestion.
Thank you for this impressive assessment. I have never looked into those parts of glibc, but if we can get an example implementation, then we will be able to request feedback from the glibc maintainers. -Imed -- Imed Chihi - عماد الشيحي http://perso.hexabyte.tn/ichihi/ _______________________________________________ Developer mailing list [email protected] http://lists.arabeyes.org/mailman/listinfo/developer

