Re: [gtk-list] Re: adding date/time calculations to glib
- From: Kenneth Albanowski <kjahds kjahds com>
- To: "Shawn T . Amundson" <amundson gimp org>
- cc: gtk-list redhat com
- Subject: Re: [gtk-list] Re: adding date/time calculations to glib
- Date: Wed, 7 Oct 1998 21:33:39 -0400 (EDT)
On Wed, 7 Oct 1998, Shawn T . Amundson wrote:
> On Wed, Oct 07, 1998 at 02:44:20PM -0500, Jon Trowbridge wrote:
> > I would like to propose that code for doing date and time calculations
> > be added to glib.
>
> I've given some thought to this recently, with the addition of
> gtkcalendar to gtk.
>
> The best C library I've found for this is from the Perl DateCalc
> module. The author based the Perl code on C code which has a
> nice interface, and would be easy to work into glib. This can
> be found in libgnome/lib_date.[ch] (you might want to make sure
> this is most current).
>
> One issue with lib_date is it is not internationalized. That's fixable.
> The month_length and day_name variables should be functions.
month_length? Month_name, surely. :-)
However, a quick glance shows some other slight issues. First, it appears
that the julian routines (among others) won't work correctly with real
Julian (pre-Gregorian) dates, and secondly, none of these routines
understand timezones.
The first issue isn't critical, but it's better to get it right. The
second is actually quite good, as a half-hearted time-zone implementation
is far worse then no timezone logic, IMO. (See the NIH zoneinfo database
at <ftp://elsie.nci.nih.gov/pub/> for a full implementation. As far as I
know, it's the only reasonably comphrehensive set of time-zone data &
logic in the world.) Treating all times as local ("wall clock") is
reasonable in the short run.
And, of course, all of this code only relates to the Gregorian calendar.
> -Shawn
>
>
> >
> > This is one area where it seems like all sorts of different free
> > programs are constantly reinventing the wheel. For example, gncal and
> > gnumeric are both using different pieces of code to do basic
> > calculations like the number of days in a month, mapping mm/dd/yyyy
> > dates to julian dates, extracting dates from strings, calculating days
> > of the week, etc.
> >
> > I'm now in a position where a few different free software projects
> > (guppi, gtk--plot and goose) that I'm working on are also going to
> > need to do date calculations. Rather than just cutting and pasting
> > the same old code into these projects, I think that we would all be
> > best served if some common code to provide this functionality was set
> > up.
> >
> > To this end, I'm volunteering to do the work necessary to add this
> > code to glib. I'd probably use timeutil.{c,h} from gncal as the basis
> > for it, but with improvements and changes to fit it into glib's naming
> > and coding conventions. gncal and gnumeric (as well as any other
> > existing code that deals with dates and times) would hopefully be
> > switched over to using the new glib code, but this wouldn't have to
> > happen right away.
> >
> > -JT
> >
> >
> >
> >
> >
> > --
> > To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> >
> --
> Shawn T. Amundson
> amundson@gimp.org http://www.gimp.org/~amundson
>
> "The assumption that the universe looks the same in every
> direction is clearly not true in reality." - Stephen Hawking
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
>
>
--
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]