This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC PATCH 51/52] Y2038: add RPC functions


Albert ARIBAUD wrote:
time_t is a signed int, but its negative range is not completely
usable since (time_t)-1 is used as an error status. So should the
TIME_T_MIN limit be LONG_MIN or should it be 0?

Definitely LONG_MIN. Functions like localtime accept -1 as valid input meaning 1969-12-31 23:59:59 UTC.

Even for some functions like mktime that return -1 as an error indicator, -1 can also be a valid (non-error) return value. I help maintain application code that can tell the difference between the two seemingly-identical -1s that mktime returns, so that the time_t range is completely usable there too. Admittedly it's not an ideal API.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]