dotgnu-pnet
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Pnet-developers] nasty DateTime bug in OSX


From: Ole Guldberg Jensen
Subject: Re: [Pnet-developers] nasty DateTime bug in OSX
Date: Fri, 13 Feb 2004 15:52:21 +0100
User-agent: Mozilla Thunderbird 0.5 (Macintosh/20040208)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Rhys Weatherley wrote:
| On Thursday 12 February 2004 03:06 am, Enrique Zamudio wrote:
|
|>in Mac OS X, DateTime.Now returns a date in the year 2063 (for today, feb
|>10, it returns aug 23, 2063). the time is also wrong (13:40 when it's
|>11:04).
|>
|>I'm using OSX 10.3.2 and have downloaded the latest cvs patches.
|
|
| It may be necessary to use a Mac-specific function to get the time.
You will
| need to modify "pnet/support/time.c" to do this.  Since I don't have
MacOSX,
| someone else will need to do it and send me the patch.
|

The attached patch works for me - thanks to ilyak for giving pointers.

Ole

- --
DarwinPorts committer, www.opendarwin.org/~olegb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFALOSjTOmSCJpH6EERAsjUAKCWbbYHsNgdjkM+dXuLLxP3bJw8ngCfdnUk
7a092CR6UDJXAndacZUvl9M=
=7VaX
-----END PGP SIGNATURE-----
--- support/time.c.org  Fri Feb 13 15:16:17 2004
+++ support/time.c      Fri Feb 13 15:23:08 2004
@@ -102,15 +102,21 @@
 #if !defined(__palmos__)
        static int initialized = 0;
        static int isdst = 0;
+       static int tz = 0;
        if(!initialized)
        {
                /* Call "localtime", which will initialise "timezone" for us */
                time_t temp = time(0);
                struct tm *tms = localtime(&temp);
                isdst = tms->tm_isdst;
+               tz =tms->tm_gmtoff;
                initialized = 1;
        }
+       #ifdef __APPLE__
+       return (ILInt32)(-tz - (isdst ? 3600 : 0));
+       #else
        return (ILInt32)(timezone - (isdst ? 3600 : 0));
+       #endif
 #else
        /* TODO */
        return 0;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]