On Wed, Dec 12, 2018 at 2:34 PM Joerg Sonnenberger <jo...@bec.de> wrote:
> On Wed, Dec 12, 2018 at 08:46:33PM +0100, Michał Górny wrote: > > While researching libc++ test failures, I've discovered that NetBSD > > suffers from the same issue as FreeBSD -- that is, both the userspace > > tooling and the kernel have problems with (time_t)-1 timestamp, > > i.e. one second before the epoch. > > I see no reason why that should be valid or more general, why any > negative value of time_t is required to be valid. > Does (time_t)-1 mean a date in 1969 (int)? Or does it mean a date in 2106 (uint32_t)? Or is it a date in 584942419325 (uint64_t)? I don't think that POSIX actually says anything about the right answer. All I could find about what time_t is the vague statement: "time_t Used for time in seconds." and the following from the time() call: 'Upon successful completion, *time*() shall return the value of time. Otherwise, (time_t)-1 shall be returned.' This strongly implies, to my mind, that -1 is not a valid time_t. Warner