Skip to main content

Crate apparent_solar_time

Crate apparent_solar_time 

Source
Expand description

Convert standard (wall-clock) datetime to Apparent Solar Time (真太阳时).

Apparent Solar Time is the time as measured by an actual sundial — when the Sun crosses your local meridian it is exactly 12:00. It differs from the clock on your wall by two corrections:

真太阳时 = 标准时 + 地理时差 + 均时差

where
  地理时差 (longitudinal correction) = 4 × (longitude − central_meridian) minutes
  均时差   (equation of time)        = ±16 min, varies by day of year

DST is handled automatically via the IANA tz database bundled in jiff, including historical rules such as China’s CDT period (1986–1991, UTC+9).

§Quick start

use apparent_solar_time::{to_apparent_solar_time, timezone_from_name};

// Birth certificate: 1990-07-15 12:00, Shanghai (China DST active → UTC+9)
let local_dt = jiff::civil::date(1990, 7, 15).at(12, 0, 0, 0);
let tz = timezone_from_name("Asia/Shanghai").unwrap();
let solar = to_apparent_solar_time(local_dt, &tz, 121.2).unwrap();
// solar ≈ 1990-07-15T10:59

Structs§

DateTime
A representation of a civil datetime in the Gregorian calendar.
TimeZone
A representation of a time zone.

Enums§

Error
Errors returned by this library.

Functions§

available_timezones
Return all IANA timezone names available on this system, in alphabetical order.
timezone_from_name
Look up a TimeZone by IANA name (e.g. "Asia/Shanghai", "America/New_York").
to_apparent_solar_time
Convert a standard (wall-clock) datetime to Apparent Solar Time (真太阳时).