When I started building a BaZi (Four Pillars) calculator, I assumed the hard part would be the astrology β the rules, the terminology, the interpretation. The rules turned out to be a lookup table. The hard part was that every birth record in the world gives you a time that isn't the time the calculation actually needs.
Here are the five traps, roughly in the order they bit me.
1. IANA time zones are city-based. Birthplaces are not.
Asia/Shanghai has been a flat +08:00 since 1901. That's true for the zone. It is not true for a birthplace.
China spans about 60 degrees of longitude and uses a single zone. Standard time is defined at 120Β°E. Chengdu sits at 104.07Β°E:
(104.07 - 120) Γ 4 minutes per degree β -64 minutes
Enter fullscreen mode
Exit fullscreen mode
Local mean time in Chengdu runs roughly 64 minutes behind the clock on the wall.β¦