added check for tm->__tm_gmtoff and tm->__tm_zone.
changed sys::strftime() to set tm_zone to GMT if sys::STRFTIME_UTC is set
This commit is contained in:
parent
4257ef5296
commit
43cfbd6bdf
33
qse/configure
vendored
33
qse/configure
vendored
@ -19904,6 +19904,39 @@ cat >>confdefs.h <<_ACEOF
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct tm" "__tm_gmtoff" "ac_cv_member_struct_tm___tm_gmtoff" "#include <time.h>
|
||||
"
|
||||
if test "x$ac_cv_member_struct_tm___tm_gmtoff" = xyes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_STRUCT_TM___TM_GMTOFF 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct tm" "tm_zone" "ac_cv_member_struct_tm_tm_zone" "#include <time.h>
|
||||
"
|
||||
if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_STRUCT_TM_TM_ZONE 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct tm" "__tm_zone" "ac_cv_member_struct_tm___tm_zone" "#include <time.h>
|
||||
"
|
||||
if test "x$ac_cv_member_struct_tm___tm_zone" = xyes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_STRUCT_TM___TM_ZONE 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
@ -328,6 +328,9 @@ AC_CHECK_MEMBERS([struct stat.st_birthtim.tv_nsec])
|
||||
AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec])
|
||||
AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec])
|
||||
AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[[#include <time.h>]])
|
||||
AC_CHECK_MEMBERS([struct tm.__tm_gmtoff],,,[[#include <time.h>]])
|
||||
AC_CHECK_MEMBERS([struct tm.tm_zone],,,[[#include <time.h>]])
|
||||
AC_CHECK_MEMBERS([struct tm.__tm_zone],,,[[#include <time.h>]])
|
||||
|
||||
|
||||
AC_CHECK_MEMBERS([struct ifreq.ifr_ifindex, struct ifreq.ifr_mtu], [], [],
|
||||
|
@ -601,6 +601,15 @@
|
||||
/* Define to 1 if `tm_gmtoff' is a member of `struct tm'. */
|
||||
#undef HAVE_STRUCT_TM_TM_GMTOFF
|
||||
|
||||
/* Define to 1 if `tm_zone' is a member of `struct tm'. */
|
||||
#undef HAVE_STRUCT_TM_TM_ZONE
|
||||
|
||||
/* Define to 1 if `__tm_gmtoff' is a member of `struct tm'. */
|
||||
#undef HAVE_STRUCT_TM___TM_GMTOFF
|
||||
|
||||
/* Define to 1 if `__tm_zone' is a member of `struct tm'. */
|
||||
#undef HAVE_STRUCT_TM___TM_ZONE
|
||||
|
||||
/* Define to 1 if you have the `swapcontext' function. */
|
||||
#undef HAVE_SWAPCONTEXT
|
||||
|
||||
|
@ -746,7 +746,17 @@ static int fnc_strftime (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||
tm.tm_isdst = bt.isdst;
|
||||
#if defined(HAVE_STRUCT_TM_TM_GMTOFF)
|
||||
tm.tm_gmtoff = bt.gmtoff;
|
||||
#elif defined(HAVE_STRUCT_TM___TM_GMTOFF)
|
||||
tm.__tm_gmtoff = bt.gmtoff;
|
||||
#endif
|
||||
if (flags & STRFTIME_UTC)
|
||||
{
|
||||
#if defined(HAVE_STRUCT_TM_TM_ZONE)
|
||||
tm.tm_zone = "GMT";
|
||||
#elif defined(HAVE_STRUCT_TM___TM_ZONE)
|
||||
tm.__tm_zone = "GMT";
|
||||
#endif
|
||||
}
|
||||
|
||||
sl = strftime(tmpbuf, QSE_COUNTOF(tmpbuf), fmt, &tm);
|
||||
if (sl <= 0 || sl >= QSE_COUNTOF(tmpbuf))
|
||||
|
@ -393,6 +393,8 @@ int qse_gmtime (const qse_ntime_t* nt, qse_btime_t* bt)
|
||||
bt->isdst = tm->tm_isdst;
|
||||
#if defined(HAVE_STRUCT_TM_TM_GMTOFF)
|
||||
bt->gmtoff = tm->tm_gmtoff;
|
||||
#elif defined(HAVE_STRUCT_TM___TM_GMTOFF)
|
||||
bt->gmtoff = tm->__tm_gmtoff;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
@ -444,6 +446,8 @@ int qse_localtime (const qse_ntime_t* nt, qse_btime_t* bt)
|
||||
bt->isdst = tm->tm_isdst;
|
||||
#if defined(HAVE_STRUCT_TM_TM_GMTOFF)
|
||||
bt->gmtoff = tm->tm_gmtoff;
|
||||
#elif defined(HAVE_STRUCT_TM___TM_GMTOFF)
|
||||
bt->gmtoff = tm->__tm_gmtoff;
|
||||
#else
|
||||
bt->gmtoff = QSE_TYPE_MIN(int); /* unknown */
|
||||
#endif
|
||||
@ -493,6 +497,8 @@ int qse_timegm (const qse_btime_t* bt, qse_ntime_t* nt)
|
||||
tm.tm_isdst = bt->isdst;
|
||||
#if defined(HAVE_STRUCT_TM_TM_GMTOFF)
|
||||
tm->tm_gmtoff = bt->gmtoff; /* i don't think this is needed. but just keep it */
|
||||
#elif defined(HAVE_STRUCT_TM___TM_GMTOFF)
|
||||
tm->__tm_gmtoff = bt->gmtoff;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_TIMEGM)
|
||||
@ -582,6 +588,8 @@ int qse_timelocal (const qse_btime_t* bt, qse_ntime_t* nt)
|
||||
tm.tm_isdst = bt->isdst;
|
||||
#if defined(HAVE_STRUCT_TM_TM_GMTOFF)
|
||||
tm.tm_gmtoff = bt->gmtoff; /* i don't think this is needed. but just keep it */
|
||||
#elif defined(HAVE_STRUCT_TM___TM_GMTOFF)
|
||||
tm->__tm_gmtoff = bt->gmtoff;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_TIMELOCAL)
|
||||
|
Loading…
Reference in New Issue
Block a user