You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[monodroid, java-runtime] Add local date time offset monovm prop (#7331)
Context: dotnet/runtime#74459
Context: dotnet/runtime#71004
Context: dotnet/runtime#54845dotnet/runtime#54845 added support TimeZoneInfo support for Android.
This was found to slow down initial use of `DateTimeOffset.Now` by
~277ms (dotnet/runtime#17004).
dotnet/runtime#74459 started reducing this startup overhead by adding
support for a new `System.TimeZoneInfo.LocalDateTimeOffset` property
on `AppContext`: if `System.TimeZoneInfo.LocalDateTimeOffset` is set,
it is used as the initial local DateTime Offset value.
Update `mono.android.MonoPackageManager.LoadApplication()` and
`libmono-android*.so` so that the
`System.TimeZoneInfo.LocalDateTimeOffset` AppContext property is set
during process startup. This can reduce `DateTimeOffset.Now` startup
overhead from ~277ms to ~50ms.
Note: `System.TimeZoneInfo.LocalDateTimeOffset` is fastest on
API-26+ (Android 8.0+) targets, as it uses
[`java.time.ZoneOffset.getTotalSeconds()`][0].
Note: `$(AndroidJavaRuntimeApiLevel)` is updated to API-26 so that
`ZoneOffset.getTotalSeconds()` can be used. Care should be taken
within `src/java-runtime` to ensure that Android API use is
appropriately protected behind runtime version checks.
[0]: https://developer.android.com/reference/kotlin/java/time/ZoneOffset#gettotalseconds
0 commit comments