Commit Graph
9 Commits
Author SHA1 Message Date
Jonathan Pryor f7fd52ad18 [mscorlib/Android] TimeZoneInfo.Local.Id should be "Local".
On Mono/.NET, TimeZoneInfo.Local has a TimeZoneInfo.Id value of
"Local" and a TimeZoneInfo.DisplayName value of "Local":

	$ csharp
	csharp> TimeZoneInfo.Local.Id;
	"Local"
	csharp> TimeZoneInfo.Local.DisplayName;
	"Local"

That isn't the case on Xamarin.Android, which returns the timezoneinfo
ID value from both DisplayName and Id, e.g. TimeZoneInfo.Local could
have Id and DisplayName values of "Australia/Sydney".

Rework things so that the TimeZoneInfo.Id and TimeZoneInfo.DisplayName
properties return "Local" on Xamarin.Android for the instance returned
from TimeZoneInfo.Local, just like normal Mono/.NET does.
2014-10-24 15:56:13 -04:00
Jonathan Pryor 8b90653ff3 [System.Core/Android] Fix standalone unit tests.
Commit 5564dad1 broke the self-test (for testing on the developer
machine, not an Android target). Fixup the comment so that appropriate
data is grabbed and used for testing, and improve
AndroidTimeZones.GetDefaultTimeZoneName() so that the default timezone
ID can be specified via the __XA_OVERRIDE_TIMEZONE_ID__ environment
variable for testing.

Finally, demonstrate TimeZoneInfo.GetUtcOffset(DateTime) use so that I
can get better insight into the timezone data stored within the
database:

	$ __XA_OVERRIDE_TIMEZONE_ID__=America/New_York ANDROID_ROOT=`pwd` ANDROID_DATA=`pwd` mono --debug tzi.exe --offset=1969-01-01
	Using DateTime Offset: 1/1/1969 12:00:00 AM
	DB type: System.AndroidTzData
	name=Africa/Abidjan                           Africa/Abidjan                          From Offset: 00:00:00
	name=Africa/Accra                             Africa/Accra                            From Offset: 00:00:00
	name=Africa/Addis_Ababa                       Africa/Addis_Ababa                      From Offset: 03:00:00
	...
2014-10-07 13:59:49 -04:00
Marek Habersack 5564dad150 Fall back to calling Java.Util.TimeZone.Default.ID if the persist.sys.timezone system
property is not present on the system or its value is an empty string. This ensures that
we obtain valid timezone info on systems which do not define the above property.

Part of fix for https://bugzilla.xamarin.com/show_bug.cgi?id=4902
2014-04-16 16:23:16 +02:00
Atsushi Eno b90937ef14 Fix android-specific build (use of unassigned variable). 2013-12-04 01:37:38 +09:00
Jonathan Pryor 82a197e41c [System.Core/Android] Support Android v4.3's timezone DB format
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=13686

Android v4.3 changed the timezone DB format described in 8a263984 and
replaced it with a single file containing version, index, data, and a
"zoneTab" (which is parsed but unused).

Port/rewrite the Java libcore.util.ZoneInfoDB type into
System.AndroidTzData so that this new file format is supported.

(Another day, another file format...)
2013-08-06 14:27:20 -04:00
Jonathan Pryor ac11abe18d [System.Core/Android] Use correct comparison for timezone ids.
Context: https://bugzilla.xamarin.com/show_bug.cgi?id=7953

The names within zoneinfo.idx are sorted ordinally, which is not the
default string comparison that Array.BinarySearch() uses.
Consequently, many timezones would not be found even though they were
present, including "Pacific/Auckland".

Use the correct string comparison so that names can be found.
2013-06-25 15:51:55 -04:00
Jonathan Pryor d49ecf5a4d [monodroid] Fix System.TimeZoneInfo.
Most System.TimeZoneInfo members weren't be included in the build.
2011-01-31 14:08:41 -05:00
Geoff Norton 16d4fd790b Further .NET 4.0 ification of the mobile profile 2011-01-25 20:10:54 -05:00
Jonathan Pryor 8a263984e9 [monodroid] Add support for the Android TimeZone file format.
Fixes #657609.

Android uses "ye standard" timezone file format, but instead of using
a directory + file structure as libc uses, they throw everything into
two files, a "zoneinfo.dat" and a "zoneinfo.idx", where "zoneinfo.dat"
is the concatenation of all the TZIF files and "zoneinfo.idx" contains
the timezone names and offsets into "zoneinfo.dat".  From the
ZoneInfoDB documentation:

	However, to conserve disk space the data for all time zones
	are concatenated into a single file, and a second file is
	used to indicate the starting position of each time zone
	record.  A third file indicates the version of the zoneinfo
	databse used to generate the data.

TimeZoneInfo.Android.cs is a C# port of the corresponding Android
ZoneInfoDB type so that Mono can use Android's timezone DB.
2010-12-16 13:17:38 -05:00