Re: time_t size: The year 2038 bug?

From: Glen Turner (glen.turner@aarnet.edu.au)
Date: Thu Jan 06 2000 - 01:47:55 EST


> > ANSI/ISO C defines time_t as a signed arithmetic type, so
> > such a change would break correct code.
>
> Are you positive?

I checked and you are right. ANSI C just requires that it
be an arithmetic type [7.12.1] (and by other rules in the
document, a *standard* arithmetic type).

I'd look in the POSIX standard, but someone has borrowed
my copy and I've just noticed that it's not on-line [1].

I'd expect POSIX to at least constrain time_t's base type to
an integer type.

Note that an unsigned time_t would break a lot of code: all
UNIXen I know of will accept a mktime() with a date prior
to the start of the epoch. Given that lots of people have
birth dates prior to the start of the epoch, calling mktime()
with such a value isn't unreasonable.

This strictly doesn't matter for the kernel, except that
implementing differing time types between the kernel and
C library causes surprises, and thus bugs.

Regards,
glen

 [1] This *really* annoys me. Standards are built from
     contributed and volunteer labour.

-- 
 Glen Turner                                 Network Engineer
 (08) 8303 3936      Australian Academic and Research Network
 glen.turner@aarnet.edu.au          http://www.aarnet.edu.au/
--
 Earth is a single point of failure

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jan 07 2000 - 21:00:05 EST