[m-rev.] for review: implement io__file_modification_time_2 in C#

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Oct 30 18:08:18 AEDT 2003


On 29-Oct-2003, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 27-Oct-2003, Peter Ross <pro at missioncriticalit.com> wrote:
> > +	// We don't use YD, WD and N.
> > + 	Time = new System.DateTime(Yr + 1900, Mnt + 1, MD, Hrs, Min, Sec);
> 
> Ignoring YD and WD is fine; mktime is supposed to do that.
> But ignoring N (the daylight savings time indicator) is not.
> On the day when you switch back to standard time from daylight savings time,
> the time "2:30am" occurs twice, once during daylight savings time (N = 1),
> and then again an hour later, during standard time (N = 0).
> 
> Not sure what to do about this right now, but at very least it warrants an XXX.

I thought about this a bit more.  There seems to be a serious problem with
the .NET APIs here.  I have posted about this to the dotnet-language-devs
mailing list (copy enclosed below).

 | Date: Thu, 30 Oct 2003 18:00:27 +1100
 | From: Fergus Henderson <fjh at cs.mu.oz.au>
 | To: DOTNET-LANGUAGE-DEVS at DISCUSS.MICROSOFT.COM
 | Subject: TimeZone.IsDayLightSavingTime inherently broken?
 | 
 | According to the documentation on MSDN,
 | System.TimeZone.IsDayLightSavingTime seems to take as its argument a
 | local time.  That seems to be fundamentally broken as designed, since
 | a local time can be ambiguous.  For example, for Pacific Standard Time,
 | the time "2003-10-26 02:30" occurs twice, once during daylight savings,
 | and then again an hour later after the switch back again.
 | 
 | The example code for the System.TimeZone class includes the following:
 | 
 |           // Get the local time zone and the current local time and year.
 |           TimeZone localZone = TimeZone.CurrentTimeZone;
 |           DateTime currentDate = DateTime.Now;
 |           ...
 |           // Display the current date and time and show if they occur 
 |           // in daylight saving time.
 |           Console.WriteLine( "\n" + timeFmt, "Current date and time:",
 |               currentDate );
 |           Console.WriteLine( dataFmt, "Daylight saving time?", 
 |               localZone.IsDaylightSavingTime( currentDate ) );
 | 
 | It seems to me that this code cannot get the correct answer for both
 | occurrences of "2003-10-26 02:30".
 | 
 | Proposed fix: add a new member IsDaylightSavingTimeUTC() to the System.TimeZone
 | class, which is the same as IsDaylightSavingTime() except that its argument
 | is a time expressed in UTC, not local time.  Deprecate the
 | IsDaylightSavingTime() member.
 | 
 | There is a similar problem with System.DateTime.ToUniversalTime().
 | It looks like that won't get the right answer for both occurrences
 | of "2003-10-26 02:30".
 | 
 | Proposed fix: deprecate that method.
 | 
 | P.S. Is there a more appropriate forum for these kinds of messages?

-- 
From: Fergus Henderson <fjh at cs.mu.oz.au>
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list