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 yearDST 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:59Structs§
- Date
Time - A representation of a civil datetime in the Gregorian calendar.
- Time
Zone - 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
TimeZoneby IANA name (e.g."Asia/Shanghai","America/New_York"). - to_
apparent_ solar_ time - Convert a standard (wall-clock) datetime to Apparent Solar Time (真太阳时).