Crate tz_search[stability] [-] [+] [src]

Compute timezones of points on the Earth.

This is a direct port of bradfitz/latlong, and hence the same bonuses/caveats apply:

It tries to have a small binary size (~360 KB), low memory footprint (~1 MB), and incredibly fast lookups (...). It does not try to be perfectly accurate when very close to borders.

A time-zone lookup with this library takes on the order of 150 ns.

Source.

Installation

Add the following to your Cargo.toml:

[dependencies]
tz-search = "0.1"

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);

Structs

TzSearch

All the information required for efficient time-zone lookups.

Functions

lookup

Attempt to compute the timezone that the point lat, long lies in.