Skip to content

Commit

Permalink
Add an example
Browse files Browse the repository at this point in the history
It's easier to test your changes if you have an example that you can
execute. Maybe it's at least a little useful to potential users, too.
  • Loading branch information
Kijewski authored and nical committed Aug 30, 2022
1 parent 6c87bfb commit b620607
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/time_zone.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// Prints the current time zone, e.g. "Europe/Paris".
use android_system_properties::AndroidSystemProperties;

fn main() {
let android_system_properties = AndroidSystemProperties::new();
let tz = android_system_properties.get("persist.sys.timezone");
println!("Your time zone is: {}", tz.as_deref().unwrap_or("<unknown>"));
}

0 comments on commit b620607

Please sign in to comment.