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

Re: projected life of the ext2 filesystem format



On Thu, 29 Jan 1998, Brian White wrote:

> > > Personally, I don't see why we can't just consider those times as unsigned.
> > > How reliable, portable, etc. is the use of negative time_t?
> > 
> > time_t foo, bar, baz;
> > foo = 10;
> > bar = 20;
> > baz = foo - bar;
> 
> If you're specifically looking for a difference, then do:
> 
> time_t foo,bar;
> int    baz;
> foo = 10;
> bar = 20;
> baz = foo-bar;
> 
> This is the same problem anywhere you're working with numbers.  Leaving
> them signed just has the opposite problem of wrapping when you don't
> expect it.

Well, since the time function is documented as returning -1 on errors,
that pretty much rules out time_t being unsigned.

time_t time(time_t *t);

DESCRIPTION
       time  returns the time since the Epoch (00:00:00 UTC, Jan-
       uary 1, 1970), measured in seconds.

       If t is non-NULL, the return value is also stored  in  the
       memory pointed to by t.

RETURN VALUE
       On  success,  the value of time in seconds since the Epoch
       is returned.  On  error,  ((time_t)-1)  is  returned,  and
       errno is set appropriately.



-- 
Scott K. Ellis <storm@gate.net>                 http://www.gate.net/~storm/


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: