5D Library › 四柱排盘的历法计算与规则引擎 · English
第二章 子时的三种约定与真太阳时
子时跨过午夜
十二时辰中,子时从 23 点到次日 1 点,横跨午夜。于是 23 点到 24 点出生的人属于哪一天,就有了约定上的分歧。通行的做法至少有三种:
- A:子初换日。 23 点起即算次日,日柱用次日,子时的天干按次日的日干起。
- B:早晚子时(夜子时)。 日柱到 24 点才换;23 点到 24 点的「晚子时」日柱仍用当日,但时干按次日的日干起。
- C:零点换日。 日柱到 24 点才换,23 点到 24 点的子时天干按当日的日干起。
推导
# Chapter 2. Three conventions for the hour from 23:00 to 24:00.
# The zi double-hour runs from 23:00 to 01:00 and straddles midnight.
# A the day changes at 23:00: 23-24 takes the next day's pillar, and
# the zi hour takes its stem from the next day (five rats).
# B the day changes at 24:00 ("late zi"): 23-24 keeps today's day
# pillar, but the zi hour takes its stem from the next day.
# C the day changes at 24:00 and the 23-24 zi hour takes its stem from
# today's day stem.
# Times are local clock times; true solar time is the next program.
STEMS = ("jia", "yi", "bing", "ding", "wu", "ji", "geng", "xin", "ren",
"gui")
BRANCHES = ("zi", "chou", "yin", "mao", "chen", "si", "wu", "wei", "shen",
"you", "xu", "hai")
def jdn(y, m, d):
a = (14 - m) // 12
yy, mm = y + 4800 - a, m + 12 * a - 3
return (d + (153 * mm + 2) // 5 + 365 * yy + yy // 4 - yy // 100
+ yy // 400 - 32045)
def pillars(day_idx, minute, rule):
"""day_idx: sexagenary index of the civil date; minute: 0..1439."""
hb = ((minute + 60) // 120) % 12
late = minute >= 23 * 60
d = day_idx + (1 if late and rule == "A" else 0)
stem_day = day_idx + (1 if late and rule in "AB" else 0)
hs = (2 * (stem_day % 10 % 5) + hb) % 10
return d % 60, hs, hb
def label(p):
d, hs, hb = p
return "{}-{} day, {}-{} hour".format(STEMS[d % 10], BRANCHES[d % 12],
STEMS[hs], BRANCHES[hb])
if __name__ == "__main__":
di = (jdn(2026, 11, 8) + 49) % 60
for t in (22 * 60 + 30, 23 * 60 + 30, 30):
for r in "ABC":
head = (" 8 Nov 2026 {:02d}:{:02d}".format(t // 60, t % 60)
if r == "A" else " " * 19)
print("{} {}: {}".format(head, r, label(pillars(di, t, r))))
print(" share of the day on which two rules differ:")
for p, q in (("A", "B"), ("A", "C"), ("B", "C")):
day = hour = 0
for t in range(1440):
a, b = pillars(di, t, p), pillars(di, t, q)
day += a[0] != b[0]
hour += a[1:] != b[1:]
print(" {} vs {}: day pillar {:.4f}, hour pillar {:.4f}".format(
p, q, day / 1440, hour / 1440))
print("\nReading: all three rules agree for 23 hours of the day; in the")
print("hour before midnight each pair differs in the day pillar, the")
print("hour stem or both: one birth in 24 by clock time.")
# 8 Nov 2026 22:30 A: bing-xu day, ji-hai hour
# B: bing-xu day, ji-hai hour
# C: bing-xu day, ji-hai hour
# 8 Nov 2026 23:30 A: ding-hai day, geng-zi hour
# B: bing-xu day, geng-zi hour
# C: bing-xu day, wu-zi hour
# 8 Nov 2026 00:30 A: bing-xu day, wu-zi hour
# B: bing-xu day, wu-zi hour
# C: bing-xu day, wu-zi hour
# share of the day on which two rules differ:
# A vs B: day pillar 0.0417, hour pillar 0.0000
# A vs C: day pillar 0.0417, hour pillar 0.0417
# B vs C: day pillar 0.0000, hour pillar 0.0417
#
# Reading: all three rules agree for 23 hours of the day; in the
# hour before midnight each pair differs in the day pillar, the
# hour stem or both: one birth in 24 by clock time.程序以 2026 年 11 月 8 日为例:22 点 30 分三种约定完全相同;23 点 30 分,A 得丁亥日庚子时,B 得丙戌日庚子时,C 得丙戌日戊子时;次日零点 30 分又全部相同。在一天的 1440 分钟中,任意两种约定只在 23 点到 24 点这 60 分钟内不同,所以按钟表时间均匀出生,分歧的比例是 0.0417,即二十四分之一。A 与 B 只在日柱上不同,B 与 C 只在时干上不同,A 与 C 两者都不同。
钟表时间与真太阳时
时辰本来是以太阳定的。钟表时间是时区的平太阳时,东八区以东经 120 度为准;真太阳时还要加上经度修正(每度 4 分钟)与均时差。第 60 本讨论过均时差的来源,这里用 NOAA 的近似公式 (NOAA Global Monitoring Laboratory, n.d.),计算东八区内几个城市全年钟表时间与真太阳时之差 。时辰长 120 分钟,所以在某一天,若 ,钟表读出的时支对 的出生是错的。
推导
# Chapter 2. Clock time against true solar time, city by city.
# All cities below keep UTC+8, whose meridian is 120 degrees east.
# True solar time = clock time + 4 min x (longitude - 120)
# + equation of time (NOAA approximation, minutes).
# A double-hour is 120 minutes long, so if true solar time differs from
# the clock by delta minutes (|delta| < 120), the hour branch read from
# the clock is wrong for the fraction |delta| / 120 of births that day.
import math
CITIES = (("Shanghai", 121.47), ("Taipei", 121.56), ("Beijing", 116.40),
("Hong Kong", 114.17), ("Chongqing", 106.55),
("Singapore", 103.82), ("Kuala Lumpur", 101.69),
("Urumqi", 87.62))
def equation_of_time(day_of_year, days_in_year=365):
g = 2 * math.pi / days_in_year * (day_of_year - 1)
return 229.18 * (0.000075 + 0.001868 * math.cos(g)
- 0.032077 * math.sin(g) - 0.014615 * math.cos(2 * g)
- 0.040849 * math.sin(2 * g))
if __name__ == "__main__":
eot = [equation_of_time(n) for n in range(1, 366)]
print(" equation of time over 2026: {:+.1f} to {:+.1f} minutes".format(
min(eot), max(eot)))
print(" city longitude offset mean |delta| hour branch")
print(" (min) (min) wrong share")
for name, lon in CITIES:
off = 4 * (lon - 120)
deltas = [abs(off + e) for e in eot]
share = sum(min(d, 120) / 120 for d in deltas) / len(deltas)
print(" {:12s} {:8.2f} {:+7.1f} {:10.1f} {:9.3f}".format(
name, lon, off, sum(deltas) / len(deltas), share))
print("\nReading: in Shanghai the clock and the sun agree to within the")
print("equation of time and about one birth in fourteen gets a different")
print("hour branch; in Kuala Lumpur and Singapore, where UTC+8 runs over")
print("an hour ahead of the sun, more than half of all births do; in")
print("Urumqi the clock hour is wrong for almost every birth.")
# equation of time over 2026: -14.3 to +16.4 minutes
# city longitude offset mean |delta| hour branch
# (min) (min) wrong share
# Shanghai 121.47 +5.9 8.3 0.069
# Taipei 121.56 +6.2 8.4 0.070
# Beijing 116.40 -14.4 14.6 0.122
# Hong Kong 114.17 -23.3 23.3 0.194
# Chongqing 106.55 -53.8 53.8 0.448
# Singapore 103.82 -64.7 64.7 0.539
# Kuala Lumpur 101.69 -73.2 73.2 0.610
# Urumqi 87.62 -129.5 129.5 0.993
#
# Reading: in Shanghai the clock and the sun agree to within the
# equation of time and about one birth in fourteen gets a different
# hour branch; in Kuala Lumpur and Singapore, where UTC+8 runs over
# an hour ahead of the sun, more than half of all births do; in
# Urumqi the clock hour is wrong for almost every birth.2026 年的均时差在 −14.3 到 +16.4 分钟之间。上海的经度修正只有 +5.9 分钟,全年平均差 8.3 分钟,时支错误的比例为 0.069;北京为 0.122,香港为 0.194。往西差距迅速扩大:重庆 0.448,新加坡 0.539,吉隆坡 0.610。新加坡与马来西亚使用东八区,钟表比太阳快一个多小时,所以一半以上的出生,钟表时间读出的时辰与太阳时不同。乌鲁木齐使用北京时间时,差距超过两小时,几乎每一个出生的时辰都不对。
注
对东南亚用户的提醒。 在吉隆坡或新加坡出生的人,若软件不做真太阳时换算,时柱多半与按太阳定时辰的排法不同。这不是哪一种排法「错」,而是约定不同;但软件应当明确告诉用户它用的是哪一种。
小结
子时的三种约定只在 23 点到 24 点之间不同,按钟表时间均匀出生时影响 0.0417 的人。钟表时间与真太阳时之差随城市而变:在上海,钟表读出的时支对 0.069 的出生不对;在新加坡与吉隆坡,这一比例超过一半;在使用北京时间的乌鲁木齐,几乎全部不对。
参考文献
Fan, Y. (2026). Four-Pillar Calendrical Computation and Formal Rule Engines: Julian-Day Sexagenary Cycles, Midnight-Boundary Disagreements, Birth-Time Sensitivity Bounds and Weighted-Graph Strength Scoring [四柱排盘的历法计算与规则引擎] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090180 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).