diff options
Diffstat (limited to 'lib/libc/stdtime/localtime.c')
-rw-r--r-- | lib/libc/stdtime/localtime.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c index 5774354..35a7071 100644 --- a/lib/libc/stdtime/localtime.c +++ b/lib/libc/stdtime/localtime.c @@ -1077,7 +1077,7 @@ struct tm * const tmp; } #ifdef _THREAD_SAFE -int +struct tm * localtime_r(timep, p_tm) const time_t * const timep; struct tm *p_tm; @@ -1086,7 +1086,7 @@ struct tm *p_tm; tzset(); localsub(timep, 0L, p_tm); pthread_mutex_unlock(&lcl_mutex); - return(0); + return(p_tm); } #endif @@ -1102,13 +1102,13 @@ const time_t * const timep; pthread_mutex_lock(&localtime_mutex); if (localtime_key < 0) { - if (pthread_keycreate(&localtime_key, free) < 0) { + if (pthread_key_create(&localtime_key, free) < 0) { pthread_mutex_unlock(&localtime_mutex); return(NULL); } } pthread_mutex_unlock(&localtime_mutex); - if (pthread_getspecific(localtime_key,(void **) &p_tm) != 0) { + if ((p_tm = pthread_getspecific(localtime_key)) != 0) { return(NULL); } else if (p_tm == NULL) { if ((p_tm = (struct tm *)malloc(sizeof(struct tm))) == NULL) { @@ -1186,13 +1186,13 @@ const time_t * const timep; pthread_mutex_lock(&gmtime_mutex); if (gmtime_key < 0) { - if (pthread_keycreate(&gmtime_key, free) < 0) { + if (pthread_key_create(&gmtime_key, free) < 0) { pthread_mutex_unlock(&gmtime_mutex); return(NULL); } } pthread_mutex_unlock(&gmtime_mutex); - if (pthread_getspecific(gmtime_key,(void **) &p_tm) != 0) { + if ((p_tm = pthread_getspecific(gmtime_key)) != 0) { return(NULL); } else if (p_tm == NULL) { if ((p_tm = (struct tm *)malloc(sizeof(struct tm))) == NULL) { @@ -1209,11 +1209,11 @@ const time_t * const timep; } #ifdef _THREAD_SAFE -int +struct tm * gmtime_r(const time_t * timep, struct tm * tm) { gmtsub(timep, 0L, tm); - return(0); + return(tm); } #endif |