Mail Archives: cygwin/2010/10/29/18:16:18
--------------enigFB43C151F331E752B3EA2710
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On 10/29/2010 04:11 PM, Ken Brown wrote:
>=20
> Thanks, Eric. I didn't know about any of this. (I was using a modificat=
ion of a configure test from the emacs sources.)
Probably worth pointing it out to the emacs upstream, then :)
> But I get the same behavior with the following revised test case:
>=20
> #include <time.h>
> #include <stdio.h>
>=20
> int
> main (void)
> {
> time_t now =3D time ((time_t *) 0);
> printf ("TZ is initially unset; hour =3D %d\n", localtime (&now)->tm_ho=
ur);
> putenv ("TZ=3DGMT0");
> printf ("TZ=3DGMT0; hour =3D %d\n", localtime (&now)->tm_hour);
> unsetenv("TZ");
> printf ("TZ unset; hour =3D %d\n", localtime (&now)->tm_hour);
> putenv ("TZ=3DPST8");
> printf ("TZ=3DPST8; hour =3D %d\n", localtime (&now)->tm_hour);
> unsetenv("TZ");
> printf ("TZ unset again; hour =3D %d\n", localtime (&now)->tm_hour);
> }
>=20
> So the question remains whether this difference between Cygwin and Linux =
is a bug or by design.
Apparently by design. POSIX requires:
http://www.opengroup.org/onlinepubs/9699919799/functions/localtime.html
Local timezone information is used as though localtime() calls tzset().
http://www.opengroup.org/onlinepubs/9699919799/functions/tzset.html
The tzset() function shall use the value of the environment variable TZ
to set time conversion information used by ctime , localtime , mktime ,
and strftime . If TZ is absent from the environment,
implementation-defined default timezone information shall be used.
But not the best of design, so a patch to fix cygwin to copy Linux'
behavior is probably appreciated.
--=20
Eric Blake eblake AT redhat DOT com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
--------------enigFB43C151F331E752B3EA2710
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iQEcBAEBCAAGBQJMy0emAAoJEKeha0olJ0NqOHIIAK/ZzSQEyeAxeIr3xqw8D+0q
NxoCDOiyXIq+QdkjF2pMmavHL9mJE+r/aGsV0DV7Supikza4t4QtFWAaD4cWI3E0
7v1U5eOznALkuMtUly7I91CfzhRf4vsxjvTDCsQUsvYzXJ1TnssxuN6KdUDzbRAT
4uS8o/ltBcmT2fQyrXkgSFv20RKTWlFfHZWAVR2WT1RmItoqQuiIah+I6m6DLmF6
QHgEg8LDMs4HA9f+ZxjQhei6NKlNvOSFYC7hK06ZswxCrI2X/U/bTwN5fTUE3HBP
o8dYKeI5aabvfrc+imrUgF+9j1YjBCJtimPFVL36q474XmR7o2ffi+V9At8Urb4=
=bX3p
-----END PGP SIGNATURE-----
--------------enigFB43C151F331E752B3EA2710--
- Raw text -