True Solar Time

v1.0.1
io.github.Shann5/true-solar-time Checked 1 day ago Published 3 months ago

True solar time correction for BaZi charts: historical DST, longitude, equation of time.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

true_solar_time True solar time correction

Convert a recorded birth time (wall clock + IANA time zone + longitude) into true solar time — the time a BaZi / Four Pillars chart should actually be cast from. Returns the corrected instant, the total correction decomposed into DST + longitude + equation-of-time (the three always sum exactly), the resulting two-hour branch, distance to the nearest branch boundary, and whether the reported clock time even existed (spring-forward DST gaps, e.g. China 1986–91). Deterministic: same input, same output, every time.

ParameterTypeDescription
day *integer
hour *integerRecorded wall-clock hour, 24h
longitude *numberBirthplace longitude in degrees, east positive (Ürümqi ≈ 87.6, Vancouver ≈ -123.1)
minute *integer
month *integer
timeZone *stringIANA time zone of the birthplace, e.g. 'Asia/Shanghai', 'America/Vancouver'
year *integerBirth year (Gregorian)

hour_branch Hour branch of a clock time

Which two-hour branch (子丑寅卯…) a given time falls in, and how many minutes it sits from the nearest branch boundary. Use on an already-corrected time; for raw birth records use true_solar_time.

ParameterTypeDescription
hour *integer
minute *integer