package home import ( "time" ) var shichenNames = [12]string{"子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"} // ShichenWindow is the current Chinese double-hour window. type ShichenWindow struct { Index int Name string Start time.Time End time.Time } // CurrentShichen returns the 十二时辰 window for now (子时 23:00–01:00 …). func CurrentShichen(now time.Time) ShichenWindow { h := now.Hour() idx := ((h + 1) % 24) / 2 startHour := (idx*2 + 23) % 24 start := time.Date(now.Year(), now.Month(), now.Day(), startHour, 0, 0, 0, now.Location()) if start.After(now) { start = start.Add(-24 * time.Hour) } return ShichenWindow{ Index: idx, Name: shichenNames[idx], Start: start, End: start.Add(2 * time.Hour), } }