Yep, a bug across 6 years and a dozen or so countries. I've just done the
round trip UTC -> Local -> UTC hourly on the quarter hour from December 20
for 20 days from 1970 to 2050 for all the "System" TimeZones and the only
times that do not return to the same UTC time are:

"(GMT+08:00) Perth" 31/12/2005 4:15:00 PM 31/12/2005 5:15:00 PM
"(GMT+08:00) Perth" 31/12/2005 5:15:00 PM 31/12/2005 6:15:00 PM
"(GMT+08:00) Perth" 31/12/2005 6:15:00 PM 31/12/2005 7:15:00 PM
"(GMT+08:00) Perth" 31/12/2005 7:15:00 PM 31/12/2005 8:15:00 PM
"(GMT+08:00) Perth" 31/12/2005 8:15:00 PM 31/12/2005 9:15:00 PM
"(GMT+08:00) Perth" 31/12/2005 9:15:00 PM 31/12/2005 10:15:00 PM
"(GMT+08:00) Perth" 31/12/2005 10:15:00 PM 31/12/2005 11:15:00 PM
"(GMT+08:00) Perth" 31/12/2005 11:15:00 PM 1/1/2006 12:15:00 AM
"(GMT+08:00) Perth" 31/12/2006 2:15:00 PM 31/12/2006 3:15:00 PM
"(GMT-03:00) Buenos Aires" 1/1/2008 1:15:00 AM 1/1/2008 2:15:00 AM
"(GMT+04:00) Port Louis" 31/12/2007 8:15:00 PM 31/12/2007 9:15:00 PM
"(GMT+04:00) Port Louis" 31/12/2007 9:15:00 PM 31/12/2007 10:15:00 PM
"(GMT+04:00) Port Louis" 31/12/2007 10:15:00 PM 31/12/2007 11:15:00 PM
"(GMT+04:00) Port Louis" 31/12/2007 11:15:00 PM 1/1/2008 12:15:00 AM
"(GMT-03:00) Buenos Aires" 1/1/2009 2:15:00 AM "ArgumentException: The
supplied DateTime represents an invalid time..."
"(GMT+04:00) Port Louis" 31/12/2008 6:15:00 PM 31/12/2008 7:15:00 PM
"(GMT+04:00) Port Louis" 31/12/2008 8:15:00 PM "ArgumentException: The
supplied DateTime represents an invalid time..."
"(GMT+04:00) Port Louis" 31/12/2008 9:15:00 PM 31/12/2008 8:15:00 PM
"(GMT+04:00) Port Louis" 31/12/2008 10:15:00 PM 31/12/2008 9:15:00 PM
"(GMT+04:00) Port Louis" 31/12/2008 11:15:00 PM 31/12/2008 10:15:00 PM
"(GMT+08:00) Perth" 31/12/2008 3:15:00 PM "ArgumentException: The supplied
DateTime represents an invalid time..."
"(GMT+08:00) Perth" 31/12/2008 4:15:00 PM "ArgumentException: The supplied
DateTime represents an invalid time..."
"(GMT+08:00) Perth" 31/12/2008 5:15:00 PM 31/12/2008 4:15:00 PM
"(GMT+08:00) Perth" 31/12/2008 6:15:00 PM 31/12/2008 5:15:00 PM
"(GMT+08:00) Perth" 31/12/2008 7:15:00 PM 31/12/2008 6:15:00 PM
"(GMT+08:00) Perth" 31/12/2008 8:15:00 PM 31/12/2008 7:15:00 PM
"(GMT+08:00) Perth" 31/12/2008 9:15:00 PM 31/12/2008 8:15:00 PM
"(GMT+08:00) Perth" 31/12/2008 10:15:00 PM 31/12/2008 9:15:00 PM
"(GMT+08:00) Perth" 31/12/2008 11:15:00 PM 31/12/2008 10:15:00 PM
"(GMT+12:00) Fiji" 31/12/2008 12:15:00 PM 31/12/2008 1:15:00 PM
"(GMT+12:00) Fiji" 31/12/2008 1:15:00 PM 31/12/2008 2:15:00 PM
"(GMT+12:00) Fiji" 31/12/2008 2:15:00 PM 31/12/2008 3:15:00 PM
"(GMT+12:00) Fiji" 31/12/2008 3:15:00 PM 31/12/2008 4:15:00 PM
"(GMT+12:00) Fiji" 31/12/2008 4:15:00 PM 31/12/2008 5:15:00 PM
"(GMT+12:00) Fiji" 31/12/2008 5:15:00 PM 31/12/2008 6:15:00 PM
"(GMT+12:00) Fiji" 31/12/2008 6:15:00 PM 31/12/2008 7:15:00 PM
"(GMT+12:00) Fiji" 31/12/2008 7:15:00 PM 31/12/2008 8:15:00 PM
"(GMT+12:00) Fiji" 31/12/2008 8:15:00 PM 31/12/2008 9:15:00 PM
"(GMT+12:00) Fiji" 31/12/2008 9:15:00 PM 31/12/2008 10:15:00 PM
"(GMT+12:00) Fiji" 31/12/2008 10:15:00 PM 31/12/2008 11:15:00 PM
"(GMT+12:00) Fiji" 31/12/2008 11:15:00 PM 1/1/2009 12:15:00 AM
"(GMT+06:00) Dhaka" 31/12/2009 4:15:00 PM 31/12/2009 5:15:00 PM
"(GMT+12:00) Fiji" 31/12/2009 10:15:00 AM 31/12/2009 11:15:00 AM
"(GMT+13:00) Samoa" 31/12/2009 11:15:00 AM 31/12/2009 12:15:00 PM
"(GMT+13:00) Samoa" 31/12/2009 12:15:00 PM 31/12/2009 1:15:00 PM
"(GMT+13:00) Samoa" 31/12/2009 1:15:00 PM 31/12/2009 2:15:00 PM
"(GMT+13:00) Samoa" 31/12/2009 2:15:00 PM 31/12/2009 3:15:00 PM
"(GMT+13:00) Samoa" 31/12/2009 3:15:00 PM 31/12/2009 4:15:00 PM
"(GMT+13:00) Samoa" 31/12/2009 4:15:00 PM 31/12/2009 5:15:00 PM
"(GMT+13:00) Samoa" 31/12/2009 5:15:00 PM 31/12/2009 6:15:00 PM
"(GMT+13:00) Samoa" 31/12/2009 6:15:00 PM 31/12/2009 7:15:00 PM
"(GMT+13:00) Samoa" 31/12/2009 7:15:00 PM 31/12/2009 8:15:00 PM
"(GMT+13:00) Samoa" 31/12/2009 8:15:00 PM 31/12/2009 9:15:00 PM
"(GMT+13:00) Samoa" 31/12/2009 9:15:00 PM 31/12/2009 10:15:00 PM
"(GMT+13:00) Samoa" 31/12/2009 10:15:00 PM 31/12/2009 11:15:00 PM
"(GMT+13:00) Samoa" 31/12/2009 11:15:00 PM 1/1/2010 12:15:00 AM
"(GMT+03:00) Kaliningrad, Minsk" 31/12/2010 9:15:00 PM 31/12/2010 10:15:00
PM
"(GMT+03:00) Kaliningrad, Minsk" 31/12/2010 10:15:00 PM 31/12/2010 11:15:00
PM
"(GMT+03:00) Kaliningrad, Minsk" 31/12/2010 11:15:00 PM 1/1/2011 12:15:00 AM
"(GMT+04:00) Moscow, St. Petersburg, Volgograd" 31/12/2010 8:15:00 PM
31/12/2010 9:15:00 PM
"(GMT+04:00) Moscow, St. Petersburg, Volgograd" 31/12/2010 9:15:00 PM
31/12/2010 10:15:00 PM
"(GMT+04:00) Moscow, St. Petersburg, Volgograd" 31/12/2010 10:15:00 PM
31/12/2010 11:15:00 PM
"(GMT+04:00) Moscow, St. Petersburg, Volgograd" 31/12/2010 11:15:00 PM
1/1/2011 12:15:00 AM
"(GMT+06:00) Ekaterinburg" 31/12/2010 6:15:00 PM 31/12/2010 7:15:00 PM
"(GMT+06:00) Ekaterinburg" 31/12/2010 7:15:00 PM 31/12/2010 8:15:00 PM
"(GMT+06:00) Ekaterinburg" 31/12/2010 8:15:00 PM 31/12/2010 9:15:00 PM
"(GMT+06:00) Ekaterinburg" 31/12/2010 9:15:00 PM 31/12/2010 10:15:00 PM
"(GMT+06:00) Ekaterinburg" 31/12/2010 10:15:00 PM 31/12/2010 11:15:00 PM
"(GMT+06:00) Ekaterinburg" 31/12/2010 11:15:00 PM 1/1/2011 12:15:00 AM
"(GMT+07:00) Novosibirsk" 31/12/2010 5:15:00 PM 31/12/2010 6:15:00 PM
"(GMT+07:00) Novosibirsk" 31/12/2010 6:15:00 PM 31/12/2010 7:15:00 PM
"(GMT+07:00) Novosibirsk" 31/12/2010 7:15:00 PM 31/12/2010 8:15:00 PM
"(GMT+07:00) Novosibirsk" 31/12/2010 8:15:00 PM 31/12/2010 9:15:00 PM
"(GMT+07:00) Novosibirsk" 31/12/2010 9:15:00 PM 31/12/2010 10:15:00 PM
"(GMT+07:00) Novosibirsk" 31/12/2010 10:15:00 PM 31/12/2010 11:15:00 PM
"(GMT+07:00) Novosibirsk" 31/12/2010 11:15:00 PM 1/1/2011 12:15:00 AM
"(GMT+08:00) Krasnoyarsk" 31/12/2010 4:15:00 PM 31/12/2010 5:15:00 PM
"(GMT+08:00) Krasnoyarsk" 31/12/2010 5:15:00 PM 31/12/2010 6:15:00 PM
"(GMT+08:00) Krasnoyarsk" 31/12/2010 6:15:00 PM 31/12/2010 7:15:00 PM
"(GMT+08:00) Krasnoyarsk" 31/12/2010 7:15:00 PM 31/12/2010 8:15:00 PM
"(GMT+08:00) Krasnoyarsk" 31/12/2010 8:15:00 PM 31/12/2010 9:15:00 PM
"(GMT+08:00) Krasnoyarsk" 31/12/2010 9:15:00 PM 31/12/2010 10:15:00 PM
"(GMT+08:00) Krasnoyarsk" 31/12/2010 10:15:00 PM 31/12/2010 11:15:00 PM
"(GMT+08:00) Krasnoyarsk" 31/12/2010 11:15:00 PM 1/1/2011 12:15:00 AM
"(GMT+09:00) Irkutsk" 31/12/2010 3:15:00 PM 31/12/2010 4:15:00 PM
"(GMT+09:00) Irkutsk" 31/12/2010 4:15:00 PM 31/12/2010 5:15:00 PM
"(GMT+09:00) Irkutsk" 31/12/2010 5:15:00 PM 31/12/2010 6:15:00 PM
"(GMT+09:00) Irkutsk" 31/12/2010 6:15:00 PM 31/12/2010 7:15:00 PM
"(GMT+09:00) Irkutsk" 31/12/2010 7:15:00 PM 31/12/2010 8:15:00 PM
"(GMT+09:00) Irkutsk" 31/12/2010 8:15:00 PM 31/12/2010 9:15:00 PM
"(GMT+09:00) Irkutsk" 31/12/2010 9:15:00 PM 31/12/2010 10:15:00 PM
"(GMT+09:00) Irkutsk" 31/12/2010 10:15:00 PM 31/12/2010 11:15:00 PM
"(GMT+09:00) Irkutsk" 31/12/2010 11:15:00 PM 1/1/2011 12:15:00 AM
"(GMT+10:00) Yakutsk" 31/12/2010 2:15:00 PM 31/12/2010 3:15:00 PM
"(GMT+10:00) Yakutsk" 31/12/2010 3:15:00 PM 31/12/2010 4:15:00 PM
"(GMT+10:00) Yakutsk" 31/12/2010 4:15:00 PM 31/12/2010 5:15:00 PM
"(GMT+10:00) Yakutsk" 31/12/2010 5:15:00 PM 31/12/2010 6:15:00 PM
"(GMT+10:00) Yakutsk" 31/12/2010 6:15:00 PM 31/12/2010 7:15:00 PM
"(GMT+10:00) Yakutsk" 31/12/2010 7:15:00 PM 31/12/2010 8:15:00 PM
"(GMT+10:00) Yakutsk" 31/12/2010 8:15:00 PM 31/12/2010 9:15:00 PM
"(GMT+10:00) Yakutsk" 31/12/2010 9:15:00 PM 31/12/2010 10:15:00 PM
"(GMT+10:00) Yakutsk" 31/12/2010 10:15:00 PM 31/12/2010 11:15:00 PM
"(GMT+10:00) Yakutsk" 31/12/2010 11:15:00 PM 1/1/2011 12:15:00 AM
"(GMT+11:00) Vladivostok" 31/12/2010 1:15:00 PM 31/12/2010 2:15:00 PM
"(GMT+11:00) Vladivostok" 31/12/2010 2:15:00 PM 31/12/2010 3:15:00 PM
"(GMT+11:00) Vladivostok" 31/12/2010 3:15:00 PM 31/12/2010 4:15:00 PM
"(GMT+11:00) Vladivostok" 31/12/2010 4:15:00 PM 31/12/2010 5:15:00 PM
"(GMT+11:00) Vladivostok" 31/12/2010 5:15:00 PM 31/12/2010 6:15:00 PM
"(GMT+11:00) Vladivostok" 31/12/2010 6:15:00 PM 31/12/2010 7:15:00 PM
"(GMT+11:00) Vladivostok" 31/12/2010 7:15:00 PM 31/12/2010 8:15:00 PM
"(GMT+11:00) Vladivostok" 31/12/2010 8:15:00 PM 31/12/2010 9:15:00 PM
"(GMT+11:00) Vladivostok" 31/12/2010 9:15:00 PM 31/12/2010 10:15:00 PM
"(GMT+11:00) Vladivostok" 31/12/2010 10:15:00 PM 31/12/2010 11:15:00 PM
"(GMT+11:00) Vladivostok" 31/12/2010 11:15:00 PM 1/1/2011 12:15:00 AM
"(GMT+12:00) Magadan" 31/12/2010 12:15:00 PM 31/12/2010 1:15:00 PM
"(GMT+12:00) Magadan" 31/12/2010 1:15:00 PM 31/12/2010 2:15:00 PM
"(GMT+12:00) Magadan" 31/12/2010 2:15:00 PM 31/12/2010 3:15:00 PM
"(GMT+12:00) Magadan" 31/12/2010 3:15:00 PM 31/12/2010 4:15:00 PM
"(GMT+12:00) Magadan" 31/12/2010 4:15:00 PM 31/12/2010 5:15:00 PM
"(GMT+12:00) Magadan" 31/12/2010 5:15:00 PM 31/12/2010 6:15:00 PM
"(GMT+12:00) Magadan" 31/12/2010 6:15:00 PM 31/12/2010 7:15:00 PM
"(GMT+12:00) Magadan" 31/12/2010 7:15:00 PM 31/12/2010 8:15:00 PM
"(GMT+12:00) Magadan" 31/12/2010 8:15:00 PM 31/12/2010 9:15:00 PM
"(GMT+12:00) Magadan" 31/12/2010 9:15:00 PM 31/12/2010 10:15:00 PM
"(GMT+12:00) Magadan" 31/12/2010 10:15:00 PM 31/12/2010 11:15:00 PM
"(GMT+12:00) Magadan" 31/12/2010 11:15:00 PM 1/1/2011 12:15:00 AM
"(GMT+13:00) Samoa" 31/12/2010 9:15:00 AM 31/12/2010 10:15:00 AM
"(GMT-03:00) Salvador" 1/1/2012 1:15:00 AM 1/1/2012 2:15:00 AM
"(GMT+03:00) Kaliningrad, Minsk" 31/12/2011 7:15:00 PM 31/12/2011 8:15:00 PM
"(GMT+04:00) Moscow, St. Petersburg, Volgograd" 31/12/2011 6:15:00 PM
31/12/2011 7:15:00 PM
"(GMT+06:00) Ekaterinburg" 31/12/2011 4:15:00 PM 31/12/2011 5:15:00 PM
"(GMT+07:00) Novosibirsk" 31/12/2011 3:15:00 PM 31/12/2011 4:15:00 PM
"(GMT+08:00) Krasnoyarsk" 31/12/2011 2:15:00 PM 31/12/2011 3:15:00 PM
"(GMT+09:00) Irkutsk" 31/12/2011 1:15:00 PM 31/12/2011 2:15:00 PM
"(GMT+10:00) Yakutsk" 31/12/2011 12:15:00 PM 31/12/2011 1:15:00 PM
"(GMT+11:00) Vladivostok" 31/12/2011 11:15:00 AM 31/12/2011 12:15:00 PM
"(GMT+12:00) Magadan" 31/12/2011 10:15:00 AM 31/12/2011 11:15:00 AM

It is feasible the Buenos Aires pair are correct if they changed their DST
or timezone over the calendar year 2008, and the other timezones that don't
roundtrip for just one hour _may_ be valid too (but I'd expect them to
throw Ambiguous or Invalid exceptions).

For completeness, here is the DotLisp I used (I truncated the exceptions
manually when pasting into Gmail):
> (dotimes y 80
    (for-each tz (TimeZoneInfo:GetSystemTimeZones)
     (let (s (DateTime.(+ y 1970) 12 20 0 15 0))
      (dotimes h 480
       (lets
        (t (s.AddHours h)
         u (E (TimeZoneInfo:ConvertTimeToUtc
(TimeZoneInfo:ConvertTimeFromUtc t tz) tz)))
        (unless (== u t)
         (prn tz.DisplayName t u)))))))

Was 2005 through 2008 when WA experimented with DST again? (Still a bug,
but this could be a reason.)

-- 
Regards,
Mark Hurd, B.Sc.(Ma.)(Hons.)

On 8 November 2012 16:22, Wallace Turner <wallacetur...@gmail.com> wrote:

>  thanks, so you concur it is bug-ish. (daylight savings usually starts in
> October)
>
>
> On 8/11/2012 10:26 AM, Mark Hurd wrote:
>
> In this case you've found an hour where WA didn't exist according to
> Microsoft's TimeZone data:
>
>  In DotLisp, with wadate as your date and wstTimezone as you've retrieved
> it:
>  > (wstTimezone.GetUtcOffset (.AddMinutes wadate 60))
> 09:00:00
> > (wstTimezone.GetUtcOffset (.AddMinutes wadate -1))
> 09:00:00
> > (TimeZoneInfo:ConvertTimeToUtc (.AddMinutes wadate -1)wstTimezone)
> 31/12/2008 2:59:00 PM
> > (TimeZoneInfo:ConvertTimeToUtc (.AddMinutes wadate 60)wstTimezone)
> 31/12/2008 4:00:00 PM
> >
>
>  All the local times in between are invalid.
>
>  Drop a note at Connect.
>
> --
> Regards,
> Mark Hurd, B.Sc.(Ma.)(Hons.)
>
>
> On 8 November 2012 10:44, Wallace Turner <wallacetur...@gmail.com> wrote:
>
>>  This question is similar to [this][1] stackoverflow question insofar as
>> the Exception thrown is clear and explicit:
>>
>> I'm converting the 1st Jan 2009 (perth time) to UTC and getting 
>> "*System.ArgumentException:
>> The supplied DateTime represents an invalid time*"
>>
>> [TestMethod]public void TestMethod1(){
>>     var date = DateTime.Parse("1-Jan-2009 00:00");
>>     var wstTimezone = TimeZoneInfo.FindSystemTimeZoneById("W. Australia 
>> Standard Time");
>>     Trace.WriteLine(wstTimezone.IsInvalidTime(date));//is invalid
>>     Trace.WriteLine(TimeZoneInfo.ConvertTime(date, wstTimezone, 
>> TimeZoneInfo.FindSystemTimeZoneById("UTC")));//throw Exception}
>>
>>
>>
>>
>> 1) I'm more curious than concerned - *Can anyone out here in the west
>> recall why this time might be invalid?* One hour either side of this
>> works ok; I can't recall daylight savings moving/changing during this
>> period.
>>
>> 2) In general, how are people handling cases like this? For example, if
>> you have a user who wants to select all the foos from 1st Jan 2009 onwards
>> then you would naturally get the start time in the users timezone
>> (1-Jan-2009 00:00) and convert to UTC - this is especially problematic if
>> you only allow the user to select the start and end date (no times) which
>> means you'd have to ask the user to select a different date completely
>> because 'midnight didnt exist in your timezone on the selected date'
>>
>> Hope I'm making sense
>>
>> Wal
>>
>>
>> [1]:
>> http://stackoverflow.com/questions/2416439/exception-calling-when-timezoneinfo-converttimetoutc-for-certain-datetime-values
>>
>
>
>

Reply via email to