-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[Android][libraries] TimeZoneInfo Android imp #54845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
1014cc6
d161105
cfa0b33
caa39a6
ee51c67
ce91611
4ed8616
555d0b5
d59fb1a
84dcbb7
cb9efd4
b68e290
65615ca
514fa44
6c3e567
3787086
912ab4d
d67920e
b602bf7
caa9229
a7aee33
fb72a04
c3f1e18
c314363
0890a23
80c28e8
858ef84
e062265
3956ff7
18c4955
37c0a0c
98ee19d
fc8ce4a
c4397b7
7188c6b
3198101
1a495cc
6e40f61
4c82a11
3cc1da1
4df973a
b4d5ba6
2bb25ce
efa339e
54e3218
144f4dd
0790650
5f4fae7
d1070d1
e20c6cb
4b31684
2616ca0
ecf6f70
3b424dc
ed3355e
2bfb9e4
5edd7ea
966aee5
290caa2
fc551d2
6fb3133
6ccad5d
0987ee7
69d5a84
8d88a6d
4433be6
8330c2a
b8bcce4
37b80ca
8891709
15d4455
6501d7e
a63f8f9
16289d2
d5ffcef
311ecaa
a07da96
a47ade2
cc06d96
00b0abe
5290490
95f30f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
mdh1418 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| using System.Collections.Generic; | ||
marek-safar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| using System.IO; | ||
|
|
||
| namespace System | ||
| { | ||
| public sealed partial class TimeZoneInfo | ||
| { | ||
| private const string TimeZoneFileName = "tzdata"; | ||
|
|
||
| private static string GetApexTimeDataRoot() | ||
| { | ||
| var ret = Environment.GetEnvironmentVariable("ANDROID_TZDATA_ROOT"); | ||
| if (!string.IsNullOrEmpty(ret)) | ||
| { | ||
| return ret; | ||
| } | ||
|
|
||
| return "/apex/com.android.tzdata"; | ||
| } | ||
|
|
||
| private static string GetApexRuntimeRoot() | ||
| { | ||
| var ret = Environment.GetEnvironmentVariable("ANDROID_RUNTIME_ROOT"); | ||
| if (!string.IsNullOrEmpty(ret)) | ||
| { | ||
| return ret; | ||
| } | ||
|
|
||
| return "/apex/com.android.runtime"; | ||
| } | ||
|
|
||
| internal static readonly string[] Paths = new string[] { GetApexTimeDataRoot() + "/etc/tz/", // Android 10+, TimeData module where the updates land | ||
| GetApexRuntimeRoot() + "/etc/tz/", // Android 10+, Fallback location if the above isn't found or corrupted | ||
| Environment.GetEnvironmentVariable("ANDROID_DATA") + "/misc/zoneinfo/",}; | ||
|
|
||
| private static string GetTimeZoneDirectory() | ||
| { | ||
| foreach (var filePath in Paths) | ||
mdh1418 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| if (File.Exists(Path.Combine(filePath, "TimeZoneFileName"))) | ||
mdh1418 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| return filePath; | ||
| } | ||
| } | ||
|
|
||
| return Environment.GetEnvironmentVariable("ANDROID_ROOT") + DefaultTimeZoneDirectory; | ||
|
||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.