- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 659
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
Add support for querying timezone on Android #846
Conversation
OK the code does not work. The compiler complains:
But I honestly don't know what's wrong with it. |
let mut get_time_zone = Command::new("getprop"); | ||
get_time_zone.arg("persist.sys.timezone"); | ||
let output = get_time_zone.output().expect("fail to get time zone"); | ||
return CompiledData::parse(output.stdout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CompiledData
is a trait, and TimeZone
is implementing this trait:
return CompiledData::parse(output.stdout); | |
return TimeZone::parse(output.stdout); |
@@ -316,7 +316,15 @@ fn determine_time_zone() -> TZResult<TimeZone> { | |||
} | |||
}) | |||
} else { | |||
TimeZone::from_file("/etc/localtime") | |||
if env::consts::OS == "android" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it’s a good practice to include the “documentation” for this change.
if env::consts::OS == "android" { | |
// https://android.googlesource.com/platform/bionic/+/master/libc/tzcode/bionic.cpp | |
if env::consts::OS == "android" { |
Well actually your approach is wrong. I’m really starting to think we should stop trying to replace the |
Closed in favor of #867 |
No description provided.