Function tz_search::lookup
[-] [+]
[src]
pub fn lookup(lat: f64, lon: f64) -> Option<String>
Attempt to compute the timezone that the point lat
, long
lies in.
The latitude lat
should lie in the range [-90, 90]
with
negative representing south, and the longitude should lie in
the range [-180, 180]
with negative representing west. This
will fail (return None
) if the point lies in the ocean.
Panics
lookup
will panic if either of the two ranges above are
violated.
Examples
let (lat, long) = (-33.8885, 151.1908); assert_eq!(tz_search::lookup(lat, long).unwrap(), "Australia/Sydney"); // in the ocean assert_eq!(tz_search::lookup(0.0, 0.0), None);