Thread-safe programming needs reentrant versions of some of the time functions. The following patch adds localtime_r and gmtime_r a'la Solaris (The Solaris manpage mentiones that these are taken from a POSIX draft, but I don't have a copy to double check). Although it is possible to write localtime and gmtime in terms of the new functions, I decided not to because they are so trival. The Solaris manpage also mentions ctime_r and asctime_r. I'll submit those later tonight. --jtc *** OLD/localtime.c Mon Oct 30 17:00:52 1995 --- localtime.c Mon Oct 30 17:03:48 1995 *************** *** 1026,1031 **** --- 1026,1041 ---- } struct tm * + localtime_r(timep, res) + const time_t * const timep; + struct tm * tm; + { + tzset(); + localsub(timep, 0L, tm); + return tm; + } + + struct tm * localtime(timep) const time_t * const timep; { *************** *** 1072,1077 **** --- 1082,1096 ---- #endif /* State Farm */ } #endif /* defined TM_ZONE */ + } + + struct tm * + gmtime_r(timep, tm) + const time_t * const timep; + struct tm * tm; + { + gmtsub(timep, 0L, tm); + return tm; } struct tm *