Ensure Local TimeZone Id is Set For TimeZoneInfo.Local (#6564)

* Mirrors the runtime change found in https://github.com/mono/mono/pull/15667.

The fix here is to return the name of the local time zone so that TimeZoneInfo.Local
can have the correct Id.

* Added nil check on name.  Returns Local as the Id in the case of nil
This commit is contained in:
Steve Pfister 2019-07-15 03:47:11 -04:00 коммит произвёл Rolf Bjarne Kvinge
Родитель 7c2cf9aa52
Коммит a7cb29a4b7
1 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -63,6 +63,11 @@ xamarin_log (const unsigned short *unicodeMessage)
[msg release];
}
// NOTE: The timezone functions are duplicated in mono, so if you're going to modify here, it would be nice
// if we modify there.
//
// See in Mono sdks/ios/runtime/runtime.m
void*
xamarin_timezone_get_data (const char *name, int *size)
{
@ -96,6 +101,18 @@ xamarin_timezone_get_names (int *count)
return result;
}
//
// Returns the geopolitical region ID of the local timezone.
const char *
xamarin_timezone_get_local_name ()
{
NSTimeZone *tz = nil;
tz = [NSTimeZone localTimeZone];
NSString *name = [tz name];
return (name != nil) ? strdup ([name UTF8String]) : strdup ("Local");
}
#if !TARGET_OS_WATCH && !TARGET_OS_TV
void
xamarin_start_wwan (const char *uri)