delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:date:from:to:subject:message-id:reply-to | |
:references:mime-version:content-type:in-reply-to; q=dns; s= | |
default; b=bzZD9cG6HskVEzoA+G4qtE5pk8CdCnVqHHECcvlSAsmPW9HA+4uZT | |
UjKO+397bLdx4zYtsmJD/cbJkaxVB4Q/CAvrf3u5GSgOZsAzXGrvCzXv8Lw5wD2F | |
tAPRzTPP05vlW45U5D9iJLF15XMq6IywBjaAv4dpgFa3slByhUCaxU= | |
DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:date:from:to:subject:message-id:reply-to | |
:references:mime-version:content-type:in-reply-to; s=default; | |
bh=PLoQq2rb/jv96dmD3a+eJ/2+L5U=; b=oU2fpi12twFN37bOlm6JTgkMajJ2 | |
/VFLTBbfeMiXOO1oRo6BAHnotMvnSMMtFHMHKvsRdbKxwlz4UM3NKsLZGbEAP9kS | |
ILHlu9Rm3/hDaFKhx6AJCo9N5+v2SeNKrxV4eoq+9NbkY62c28St7VsPjwiAYvlk | |
hY6sQG9RlDEcom8= | |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Authentication-Results: | sourceware.org; auth=none |
X-Virus-Found: | No |
X-Spam-SWARE-Status: | No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 |
X-HELO: | calimero.vinschen.de |
Date: | Wed, 5 Mar 2014 12:35:24 +0100 |
From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: struct tm problem |
Message-ID: | <20140305113524.GB2192@calimero.vinschen.de> |
Reply-To: | cygwin AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
References: | <CAJoYywWqyBYEJKriugeU0deHm=DsS_LYgHotaX6K=q6TO_tmQQ AT mail DOT gmail DOT com> <20140304081928 DOT GF7236 AT calimero DOT vinschen DOT de> <CAJoYywUF2gpX5+-9H3gExyRMYUtJQyi_mHOX42uG9kRfaQ0Nvg AT mail DOT gmail DOT com> |
MIME-Version: | 1.0 |
In-Reply-To: | <CAJoYywUF2gpX5+-9H3gExyRMYUtJQyi_mHOX42uG9kRfaQ0Nvg@mail.gmail.com> |
User-Agent: | Mutt/1.5.21 (2010-09-15) |
--PmA2V3Z32TCmWXqI Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mar 5 11:45, Irfan Adilovic wrote: > On Tue, Mar 4, 2014 at 9:19 AM, Corinna Vinschen wrote: > > On Mar 3 23:28, Irfan Adilovic wrote: > >> (Please note the date of the quoted emails) > >> > >> On Mon, May 23, 2005 at 07:58:01PM -0700, Yitzchak Scott-Thoennes wrot= e: > >> > On Mon, May 23, 2005 at 06:34:21PM +0430, Alireza Ghasemi wrote: > >> > > Hello, > >> > > I have downloaded some c++ libraries and tried to download them.Bu= t All of > >> > > them give an error like : > >> > > "'struct tm' has no member called 'tm_gmtoff'" > >> > > (tm is defined as 'time_t t; time(&t);tm* ptm =3D localtime(&t);') > >> > > I guess that tm should be defined in ctime header. > >> > > What's the problem and what should I do? > >> > > Thanks > >> > > >> > tm_gmtoff is not required by the standard: > >> > http://www.opengroup.org/onlinepubs/009695399/basedefs/time.h.html > >> > > >> > However, it is an extension available in the Olson tzcode, which > >> > cygwin seems to use. Enabling it would seem to be a matter of > >> > setting -DTM_GMTOFF=3Dtm_gmtoff and adding it to time.h. > > > > And same for TM_ZONE. > > > >> I have successfully done this and use the tm_gmtoff in my code > >> actively. Is there a reason this isn't enabled? Is there any interest > >> in the community to make tm_gmtoff available by default (It's so easy, > >> it's a shame it's not :-))? > > > > It's easy to change the struct, but changing the size of a structure > > is an incompatible change to existing applications which leads to > > overwriting memory. > > > > A change to Cygwin involves an extra check if the application has been > > build against an older or a newer version of Cygwin, and to fill the > > tm_gmtoff/tm_zone structure members dependent on that. So it's not just > > done by defining TM_GMTOFF and TM_ZONE. >=20 > Now that you mention the incompatibility, it seems logical -- the size > of the struct is hard-coded when allocation frames in the executable > (or when mallocing), and passing that to the library will write > tm_gmtoff past the allocated area -- but how can one even try to > recognize and act upon that at runtime, without recompiling the > executable? The Cygwin DLL can check under which version of the Cygwin DLL an executable has been compiled. We're using this knowledge already in other circumstances. If the DLL finds it has been compiled under an old Cygwin version which doesn't know these new members, it will not try to read or write these members, if it's an executabled compiled under a newer DLL which knows these members, it will utilize them. If you're running a new executable under an old version of the DLL, the members will probably contain garbage, but that's an unsupported scenario anyway. Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --PmA2V3Z32TCmWXqI Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJTFwv8AAoJEPU2Bp2uRE+g2vsP/0oDl0WXj7uK2L/qtpHlr08T gZNDH+01RV89tUcWclpFMNb9KCm6zBr5z/v+dWuN40Z5gSqxJsOgwJRQr56KFhCb +0sVEwThZl0boR1E6Kl5ep4vl5DxGQ5Y37ZzRNOFo1zvtY/1ogHZofu3uSpEycMi /9PtFY4qfNHw+XSrqG2+MUQ45MM4wtbE3sUrGmpK05BgKXMZem0jnL4NA80nguTY 0puLnKcApCkquI5ZG8MGfW72v7Oic4Cd2KDJ+iUJybPRvHOlpwwMyQlS5NMSRzkQ EyG9NVciO4CfYhezlWvcV1kmn3c33jceDE1aIdRVJKpyyx2AdJaQktN3Wb7YpgcA UtjOEMLtzG5T/xT67jMVuwLvyUCJrYFAVkDaYZsFb2jnDEI+aIqkTumUzVS/6XpA NRn4kxv5Maql8PahVo78gyxRtznQ6Q9+0HXldiuThBAJG9Oh/0+zGFogElE0KC5/ bEanii+j4TGqqSQrDFlHRp+DOP7gjjUzR7fvu7QgFPezZGghNhwzITyHrTKUcwBm I3roiRYClHcOxOPiZesX1bA2Z1CdQYzVsuwO0bxVHxX1RIDPmFVaQhN6PZiySjZV R6WTbCKy5IzHMmWGfF+AhT9Sg7M1RaALLhcfC+TrbBJs42ZfniLQXXOXoz2RfjgH 2u7FgtKE8mYLHgswYvmv =ZPOk -----END PGP SIGNATURE----- --PmA2V3Z32TCmWXqI--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |