localtime.c (17209) | localtime.c (17706) |
---|---|
1/* 2** This file is in the public domain, so clarified as of 3** June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov). 4*/ 5 6#ifndef lint 7#ifndef NOID 8static char elsieid[] = "@(#)localtime.c 7.57"; --- 154 unchanged lines hidden (view full) --- 163#ifndef TZ_STRLEN_MAX 164#define TZ_STRLEN_MAX 255 165#endif /* !defined TZ_STRLEN_MAX */ 166 167static char lcl_TZname[TZ_STRLEN_MAX + 1]; 168static int lcl_is_set; 169static int gmt_is_set; 170#ifdef _THREAD_SAFE | 1/* 2** This file is in the public domain, so clarified as of 3** June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov). 4*/ 5 6#ifndef lint 7#ifndef NOID 8static char elsieid[] = "@(#)localtime.c 7.57"; --- 154 unchanged lines hidden (view full) --- 163#ifndef TZ_STRLEN_MAX 164#define TZ_STRLEN_MAX 255 165#endif /* !defined TZ_STRLEN_MAX */ 166 167static char lcl_TZname[TZ_STRLEN_MAX + 1]; 168static int lcl_is_set; 169static int gmt_is_set; 170#ifdef _THREAD_SAFE |
171static pthread_mutex_t lcl_mutex = PTHREAD_MUTEX_INITIALIZER; 172static pthread_mutex_t gmt_mutex = PTHREAD_MUTEX_INITIALIZER; | 171static struct pthread_mutex _lcl_mutexd = PTHREAD_MUTEX_INITIALIZER; 172static struct pthread_mutex _gmt_mutexd = PTHREAD_MUTEX_INITIALIZER; 173static pthread_mutex_t lcl_mutex = &_lcl_mutexd; 174static pthread_mutex_t gmt_mutex = &_gmt_mutexd; |
173#endif 174 175char * tzname[2] = { 176 wildabbr, 177 wildabbr 178}; 179 180/* --- 901 unchanged lines hidden (view full) --- 1082} 1083#endif 1084 1085struct tm * 1086localtime(timep) 1087const time_t * const timep; 1088{ 1089#ifdef _THREAD_SAFE | 175#endif 176 177char * tzname[2] = { 178 wildabbr, 179 wildabbr 180}; 181 182/* --- 901 unchanged lines hidden (view full) --- 1084} 1085#endif 1086 1087struct tm * 1088localtime(timep) 1089const time_t * const timep; 1090{ 1091#ifdef _THREAD_SAFE |
1090 static pthread_mutex_t localtime_mutex = PTHREAD_MUTEX_INITIALIZER; | 1092 static struct pthread_mutex _localtime_mutex = PTHREAD_MUTEX_INITIALIZER; 1093 static pthread_mutex_t localtime_mutex = &_localtime_mutex; |
1091 static pthread_key_t localtime_key = -1; 1092 struct tm *p_tm; 1093 1094 pthread_mutex_lock(&localtime_mutex); 1095 if (localtime_key < 0) { 1096 if (pthread_keycreate(&localtime_key, free) < 0) { 1097 pthread_mutex_unlock(&localtime_mutex); 1098 return(NULL); --- 66 unchanged lines hidden (view full) --- 1165#endif /* defined TM_ZONE */ 1166} 1167 1168struct tm * 1169gmtime(timep) 1170const time_t * const timep; 1171{ 1172#ifdef _THREAD_SAFE | 1094 static pthread_key_t localtime_key = -1; 1095 struct tm *p_tm; 1096 1097 pthread_mutex_lock(&localtime_mutex); 1098 if (localtime_key < 0) { 1099 if (pthread_keycreate(&localtime_key, free) < 0) { 1100 pthread_mutex_unlock(&localtime_mutex); 1101 return(NULL); --- 66 unchanged lines hidden (view full) --- 1168#endif /* defined TM_ZONE */ 1169} 1170 1171struct tm * 1172gmtime(timep) 1173const time_t * const timep; 1174{ 1175#ifdef _THREAD_SAFE |
1173 static pthread_mutex_t gmtime_mutex = PTHREAD_MUTEX_INITIALIZER; | 1176 static struct pthread_mutex _gmtime_mutex = PTHREAD_MUTEX_INITIALIZER; 1177 static pthread_mutex_t gmtime_mutex = &_gmtime_mutex; |
1174 static pthread_key_t gmtime_key = -1; 1175 struct tm *p_tm; 1176 1177 pthread_mutex_lock(&gmtime_mutex); 1178 if (gmtime_key < 0) { 1179 if (pthread_keycreate(&gmtime_key, free) < 0) { 1180 pthread_mutex_unlock(&gmtime_mutex); 1181 return(NULL); --- 564 unchanged lines hidden --- | 1178 static pthread_key_t gmtime_key = -1; 1179 struct tm *p_tm; 1180 1181 pthread_mutex_lock(&gmtime_mutex); 1182 if (gmtime_key < 0) { 1183 if (pthread_keycreate(&gmtime_key, free) < 0) { 1184 pthread_mutex_unlock(&gmtime_mutex); 1185 return(NULL); --- 564 unchanged lines hidden --- |