Bug 22700 - GetUtcOffset with Dates less than 1970/01/01
Summary: GetUtcOffset with Dates less than 1970/01/01
Status: RESOLVED DUPLICATE of bug 22955
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.16.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Marek Habersack
Depends on:
Reported: 2014-09-05 11:50 UTC by jonathan_chapman
Modified: 2014-09-22 20:02 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description jonathan_chapman 2014-09-05 11:50:46 UTC
I just upgraded to 3.5.55 and now TimeZone.CurrentTimeZone.GetUtcOffset with a date of 1969-12-31 18:59:59.999 gives the following error:

09-05 11:27:02.543 E/ApexWare( 4816): System.ArgumentOutOfRangeException: Argument is out of range.
09-05 11:27:02.543 E/ApexWare( 4816):   at System.DateTime.op_Subtraction (DateTime d, TimeSpan t) [0x00000] in <filename unknown>:0 
09-05 11:27:02.543 E/ApexWare( 4816):   at Android.Runtime.AndroidCurrentSystemTimeZone.IsAmbiguousTime (DateTime time) [0x0001d] in /Users/builder/data/lanes/1131/62e09eb0/source/monodroid/src/Mono.Android/src/Runtime/AndroidCurrentSystemTimeZone.cs:113 
09-05 11:27:02.543 E/ApexWare( 4816):   at Android.Runtime.AndroidCurrentSystemTimeZone.GetUtcOffset (DateTime time) [0x00049] in /Users/builder/data/lanes/1131/62e09eb0/source/monodroid/src/Mono.Android/src/Runtime/AndroidCurrentSystemTimeZone.cs:100 

my guess is that it's related to the fix for bug 20172.  This had been working up until the upgrade.
Comment 1 Arpit Jha 2014-09-11 06:20:31 UTC
I have checked this issue and unable to reproduce it.
I tried following steps to reproduce it.
1.Create an Android application.
2.Did following code to get current time zone.

TimeZone.CurrentTimeZone.GetUtcOffset(Convert.ToDateTime("1969-12-31 18:59:59.999")).ToString();

I observed that i am able to get current time zone like 05:30:00

Screencast regarding same:  http://screencast.com/t/3VKtU5IPCai

Let me know if I missed anything to reproduce it

Environment Info:
VS Professional 2013 
Comment 2 jonathan_chapman 2014-09-11 08:32:49 UTC
The only thing different is that we're creating the date with the following:

new DateTime(1970,1,1,0,0,0).AddMilliseconds(-1)
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2014-09-22 20:02:45 UTC
Thanks for the report! Marking as a duplicate of the newer bug just because by chance there was additional back-and-forth about version numbers and steps to reproduce on that bug.

*** This bug has been marked as a duplicate of bug 22955 ***