Subject: Re: Before I offically call this a time bug can someone else try this? (fwd)
To: Chris Torek <torek@BSDI.COM>
From: Charles M. Hannum <mycroft@mit.edu>
List: tech-kern
Date: 08/06/1998 20:31:05
>People keep saying this, but if time_t were unsigned, and you did:
>
>        time_t now;
>        time_t offset;
>        time_t yesterday;
>        ...
>        time(&now);
>        offset = -86400;
>        yesterday = now + offset;
>
>"yesterday" would still be set to the same value as with signed
>time_t's (provided time_t is unsigned int, unsigned long, or
>unsigned long long, or is unsigned short with sizeof(short)==sizeof(int),
>or is unsigned char with sizeof(char)==sizeof(int) -- the latter
>two are due to ANSI widening rules, which depend on relative widths).

You're assuming twos-complement arithmetic and the `usual'
implementation of promoting a negative number to unsigned.  ANSI C
does *not* gaurantee that it will do what you expect.