[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] new module: timegm

From: Bruno Haible
Subject: Re: [Bug-gnulib] new module: timegm
Date: Mon, 1 Sep 2003 19:58:49 +0200
User-agent: KMail/1.5

Simon Josefsson wrote:
> It seem to work (on >>10 platforms).
> New module below, based on the code above.

Perfect. I've committed your patch.

> I used gmtime_r() where available(*),

Yes, of course it's preferrable to use the MT-safe version of a function
if possible.

> Still, the code treat time_t as an arithmetic type, which I believe is
> only permitted by POSIX, not C89.  So I'm not sure how to classify it,
> extension of C89 or POSIX?

So few people know this detail, and so much code would break if time_t
were not a scalar type, that it's not worth making the difference.

> The interface is an extension of C89, but
> the implementation assumes POSIX.  The patch add it as a extra
> function based on C89 in MODULES.html.sh

Well done. I see it as a C89 extension too,

> Another problem is if it should depend on the mktime module.  What is
> the point of the mktime module, exactly?  The description says it
> implement mktime, but the m4 file seem to check for various buggy
> implementations.  It is listed as a module for systems lacking C89.
> mktime is part of C89.  So if modules can assume C89, timegm should
> not depend on mktime

Exactly, right. These modules classified as "for systems lacking C89"
are for ancient systems; every package can include them or not, on their
own responsibility. gnulib doesn't force any package to use these modules;
therefore we also omit the dependency.

> Hence the AC_CHECK_DECLS(gmtime_r), so
> gmtime_r will only be used if the application somehow causes
> _REENTRANT to be defined, which seem to be the right solution.

Yes, right.

>       * timegm.h, timegm.c: New files.  Based on WGET 1.8.2
>       http.c:mktime_from_utc.

Fine, you were able to take a copy of this code which was already under
FSF copyright.

> +  if (tb == (time_t) - 1)

I tweaked this to read

     if (tb == (time_t) -1)

because we also routinely write "(size_t) -1" without a space after the


reply via email to

[Prev in Thread] Current Thread [Next in Thread]