Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
gateway: TestHeldClock passes each zone in instead of writing time.Local (#2949)
yetoneb641868eb351
diff --git a/internal/gateway/routing.go b/internal/gateway/routing.goindex 865000fb0..69a84685b 100644--- a/internal/gateway/routing.go+++ b/internal/gateway/routing.go@@ -602,8 +602,11 @@ var zhipuResets = regexp.MustCompile(`(?:\bYour limit will reset at|您的限额// offset goes with it: "20:12 UTC+8" today, else "Oct 16 09:00 UTC+8".// Without it a magpie on UTC+8 said "not asked again before 17:12" to a// user who couldn't tell whose 17:12 it was (Player on Discord).-func heldClock(t, now time.Time) string {- t, now = t.Local(), now.Local()+func heldClock(t, now time.Time) string { return heldClockIn(t, now, time.Local) }++// heldClockIn is heldClock on the clock of loc.+func heldClockIn(t, now time.Time, loc *time.Location) string {+ t, now = t.In(loc), now.In(loc)s := t.Format("Jan 2 15:04")if y, m, d := t.Date(); now.Year() == y && now.Month() == m && now.Day() == d {s = t.Format("15:04")diff --git a/internal/gateway/zhipu_resets_test.go b/internal/gateway/zhipu_resets_test.goindex 85cb1126c..f8bf736f6 100644--- a/internal/gateway/zhipu_resets_test.go+++ b/internal/gateway/zhipu_resets_test.go@@ -74,7 +74,9 @@ func TestResetsZhipu(t *testing.T) {}// heldClock gives the time with its offset, so a reader on another clock-// can tell whose it is.+// can tell whose it is. Each zone is passed in, never set on time.Local:+// time.Now reads time.Local, and a goroutine an earlier test left running+// read it while this test wrote it, a race on ubuntu CI (run 39242954115).func TestHeldClock(t *testing.T) {cst := time.FixedZone("CST", 8*3600)now := time.Date(2026, 10, 15, 16, 25, 0, 0, cst)@@ -88,10 +90,7 @@ func TestHeldClock(t *testing.T) {{time.UTC, time.Date(2026, 10, 15, 20, 12, 13, 0, cst), "12:12 UTC+0"},{time.FixedZone("", -(3*3600 + 30*60)), time.Date(2026, 10, 15, 20, 12, 13, 0, cst), "08:42 UTC-3:30"},} {- was := time.Local- time.Local = c.zone- got := heldClock(c.at, now)- time.Local = was+ got := heldClockIn(c.at, now, c.zone)if got != c.want {t.Errorf("%v in %v: %q, want %q", c.at, c.zone, got, c.want)}