parent
a1419a0806
commit
0975413298
3 changed files with 11 additions and 3 deletions
|
@ -167,7 +167,7 @@ char * strcasestr (const char *haystack, const char *needle)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LOCALTIME_R
|
||||
#if ! defined(HAVE_LOCALTIME_R) && ! defined(__MINGW32__)
|
||||
struct tm *localtime_r(const time_t *timep, struct tm *result)
|
||||
{
|
||||
return localtime(timep);
|
||||
|
@ -247,8 +247,12 @@ int date_dos2unix(const unsigned short f_time, const unsigned short f_date)
|
|||
void set_secwest(void)
|
||||
{
|
||||
const time_t t = time(NULL);
|
||||
#if defined(__MINGW32__)
|
||||
const struct tm *tmptr = localtime(&t);
|
||||
#else
|
||||
struct tm tmp;
|
||||
const struct tm *tmptr = localtime_r(&t,&tmp);
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_TM_TM_GMTOFF
|
||||
if(tmptr)
|
||||
secwest = -1 * tmptr->tm_gmtoff;
|
||||
|
|
|
@ -496,7 +496,7 @@ int strncasecmp(const char * s1, const char * s2, size_t len);
|
|||
#ifndef HAVE_STRCASESTR
|
||||
char * strcasestr (const char *haystack, const char *needle);
|
||||
#endif
|
||||
#ifndef HAVE_LOCALTIME_R
|
||||
#if ! defined(HAVE_LOCALTIME_R) && ! defined(__MINGW32__)
|
||||
struct tm *localtime_r(const time_t *timep, struct tm *result);
|
||||
#endif
|
||||
/*
|
||||
|
|
|
@ -156,9 +156,13 @@ void mode_string (const unsigned int mode, char *str)
|
|||
int set_datestr(char *datestr, size_t n, const time_t timev)
|
||||
{
|
||||
int test_date=0;
|
||||
struct tm tmp;
|
||||
const struct tm *tm_p;
|
||||
#if defined(__MINGW32__)
|
||||
if(timev!=0 && (tm_p= localtime(&timev))!=NULL)
|
||||
#else
|
||||
struct tm tmp;
|
||||
if(timev!=0 && (tm_p= localtime_r(&timev, &tmp))!=NULL)
|
||||
#endif
|
||||
{
|
||||
snprintf(datestr, n,"%2d-%s-%4d %02d:%02d",
|
||||
tm_p->tm_mday, monstr[tm_p->tm_mon],
|
||||
|
|
Loading…
Reference in a new issue