httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Life is hard, and then you die." <ron...@innovation.ch>
Subject Re: cvs commit: apache-2.0/src/lib/apr/network_io/unix sendrecv.c sockets.c
Date Sat, 04 Sep 1999 07:12:01 GMT

One day, Greg Stein wrote:
> 
> Manoj Kasichainula wrote:
> > 
> > On Fri, Sep 03, 1999 at 02:29:54AM -0700, Greg Stein wrote:
> > > Can you truly rely on time_t being a signed type? I don't think that you
> > > can.
> > 
> > I always thought you could; isn't the reason for the 2038 overflow
> > that time_t is signed?
> 
> yah, but I figured the definition might change one day to unsigned :-)
> 
> > Also, the Single Unix man page for time() (which I would think would
> > agree with even the non-SUS stuff out there) says it returns -1 on
> > error.
> 
> ah. well, this certainly clutches it.

Hmm, not necessarily. The ANSI C spec says 1) that time_t is an
arithmetic type, and 2) that if the time is not available, time()
returns `(time_t) -1'. This does not require time_t to be signed.
So, doing 'if (sec >= 0)' not strictly portable; the only way is
'if (sec != (time_t) -1)'.


  Cheers,

  Ronald


Mime
View raw message