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

assert_eq!(tz_search::lookup(-33.79, 151.17).unwrap(),
           "Australia/Sydney");

// in the ocean
assert_eq!(tz_search::lookup(0.0, 0.0), None);