diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2014-03-05 16:45:49 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2014-03-05 16:45:49 +0400 |
commit | 27afe3a4abea797790659f7ce2302a6105f9d475 (patch) | |
tree | ef28b87aee071710775ef68a4ffc445987bf5686 /winsup/cygwin/localtime.cc | |
parent | 07be216aabff46148510557d1ce6cef470a2a002 (diff) |
* localtime.cc: Define TM_GMTOFF and TM_ZONE based on __TM_GMTOFF and
__TM_ZONE being defined. Throughout, write to these struct tm members
only if CYGWIN_VERSION_CHECK_FOR_EXTRA_TM_MEMBERS is true.
* libc/strptime.cc: Ditto.
* include/cygwin/version.h (CYGWIN_VERSION_CHECK_FOR_EXTRA_TM_MEMBERS):
Define.
(CYGWIN_VERSION_API_MINOR): Bump to 272.
Diffstat (limited to 'winsup/cygwin/localtime.cc')
-rw-r--r-- | winsup/cygwin/localtime.cc | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/winsup/cygwin/localtime.cc b/winsup/cygwin/localtime.cc index a5307101e..29371703e 100644 --- a/winsup/cygwin/localtime.cc +++ b/winsup/cygwin/localtime.cc @@ -344,6 +344,13 @@ struct tzhead { #include "fcntl.h" +#ifdef __TM_GMTOFF +# define TM_GMTOFF __TM_GMTOFF +#endif +#ifdef __TM_ZONE +# define TM_ZONE __TM_ZONE +#endif + /* ** SunOS 4.1.1 headers lack O_BINARY. */ @@ -1740,7 +1747,8 @@ localsub(const timezone_t sp, const time_t * const timep, const long offset, if (sp == lclptr) tzname[tmp->tm_isdst] = &sp->chars[ttisp->tt_abbrind]; #ifdef TM_ZONE - tmp->TM_ZONE = &sp->chars[ttisp->tt_abbrind]; + if (CYGWIN_VERSION_CHECK_FOR_EXTRA_TM_MEMBERS) + tmp->TM_ZONE = &sp->chars[ttisp->tt_abbrind]; #endif /* defined TM_ZONE */ return result; } @@ -1793,13 +1801,16 @@ gmtsub(const timezone_t sp, const time_t *const timep, const long offset, ** "UTC+xxxx" or "UTC-xxxx" if offset is non-zero, ** but this is no time for a treasure hunt. */ - if (offset != 0) - tmp->TM_ZONE = wildabbr; - else { - if (gmtptr == NULL) - tmp->TM_ZONE = gmt; - else tmp->TM_ZONE = gmtptr->chars; - } + if (CYGWIN_VERSION_CHECK_FOR_EXTRA_TM_MEMBERS) + { + if (offset != 0) + tmp->TM_ZONE = wildabbr; + else { + if (gmtptr == NULL) + tmp->TM_ZONE = gmt; + else tmp->TM_ZONE = gmtptr->chars; + } + } #endif /* defined TM_ZONE */ return result; } @@ -1978,7 +1989,8 @@ timesub(const timezone_t sp, const time_t *const timep, const long offset, tmp->tm_mday = (int) (idays + 1); tmp->tm_isdst = 0; #ifdef TM_GMTOFF - tmp->TM_GMTOFF = offset; + if (CYGWIN_VERSION_CHECK_FOR_EXTRA_TM_MEMBERS) + tmp->TM_GMTOFF = offset; #endif /* defined TM_GMTOFF */ return tmp; } |