[Mono-list] Mono 0.28 - Still fails under windows 2000 P

Paul Paximadis ppaximadis@websoft.co.za
Mon, 6 Oct 2003 08:53:50 +0200


I tried setting my TimeZone setting to something else and the program =
compiled fine and run fine.
I changed it from "(GMT+02:00) Harare, Pretoria" to "(GMT+02:00) Cairo" =
and everything works fine.
This worked with "Automatically adjust clock for daylight savings =
changes" checked or not.

I then changed to "(GMT-07:00) Arizona" and the error came back.

It seems that the Time Zones that do not have setting for "Automatically =
adjust clock for daylight savings changes" create the error.

I cant test this patch as I am at work and do not have cygwin etc.. =
Setup here.
I can test an executable for you if you want, but you might be able to =
recreate the problem if you change your TimeZone settings.

Thanks for all your help
Paul


-----Original Message-----
From: Varga Zoltan [mailto:vargaz@freemail.hu]=20
Sent: Sunday, October 05, 2003 16:59
To: Atsushi Eno
Cc: Paul Paximadis; Mono-List
Subject: Re: [Mono-list] Mono 0.28 - Still fails under windows 2000 P



                                                 Hi,

  I checked in a fix for these problems. I hope it is is correct. I =
tested it by setting the timezone to GMT (i.e. no dayling saving).=20

The patch is the following:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Index: icall.c =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/mono/mono/metadata/icall.c,v
retrieving revision 1.339
diff -u -3 -p -r1.339 icall.c
--- icall.c	26 Sep 2003 16:25:40 -0000	1.339
+++ icall.c	5 Oct 2003 15:08:17 -0000
@@ -3121,9 +3121,11 @@ ves_icall_System_CurrentTimeZone_GetTime
 	TIME_ZONE_INFORMATION tz_info;
 	FILETIME ft;
 	int i;
-	int err;
+	int err, tz_id;
 =09
-	GetTimeZoneInformation (&tz_info);
+	tz_id =3D GetTimeZoneInformation (&tz_info);
+	if (tz_id =3D=3D TIME_ZONE_ID_INVALID)
+		return 0;
=20
 	MONO_CHECK_ARG_NULL (data);
 	MONO_CHECK_ARG_NULL (names);
@@ -3139,6 +3141,19 @@ ves_icall_System_CurrentTimeZone_GetTime
 		if (!tz_info.StandardName [i])
 			break;
 	mono_array_set ((*names), gpointer, 0,
mono_string_new_utf16 (domain, tz_info.StandardName, i));
+
+	if ((year <=3D 1601) || (year > 30827)) {
+		/*
+		 * According to MSDN, the MS time functions can't handle
dates outside
+		 * this interval.
+		 */
+		return 1;
+	}
+
+	if (tz_id =3D=3D TIME_ZONE_ID_UNKNOWN) {
+		/* No daylight saving in this time zone */
+		return 1;
+	}
=20
 	tz_info.StandardDate.wYear =3D year;
 	err =3D SystemTimeToFileTime (&tz_info.StandardDate, &ft); =
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Could somebody who is actually seeing this problem test it
and see
if it fixes the problem? If it is, then we can make a new windows =
release with only this patch.

                              bye

                                  Zoltan



Atsushi Eno <ginga@kit.hi-ho.ne.jp> =EDrta:

> Hello,
>=20
> After applying attached patch, this problem looks gone away. But I=20
> don't know it might break this method.
>=20
> Atsushi Eno
>=20
>=20