Install any skill in seconds. Free to start, no credit card required.
Get Started Free →doccker/cc-time-zone-safety
时区安全检查,防止生产环境时区漂移导致的统计错乱。
Passed 21 of 22 test cases with the skill, and 17 of 22 without it.
and 2 more in the full report
5 fixed16 passed either way0 still failing1 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 5 test cases the skill fixed. Same model, same prompt, with and without the skill.
Write Python code using `datetime` and `zoneinfo` to fetch the current time aware of the `Asia/Shanghai` timezone.
| Checked | Without skill | With skill |
|---|---|---|
| The code imports ZoneInfo from zoneinfo. | Passed | Passed |
| The code passes tz=ZoneInfo('Asia/Shanghai') to datetime.now(). | Missed | Passed |
The instructions your model reads when the skill loads.
服务端代码里,"当前时间"几乎从不应该裸调。一个 docker 镜像默认 UTC、一个生产机配置 Asia/Shanghai,同一份代码跑出来的"本周起点"就差 8 小时。
配套:
query-performance-safety(性能) /multi-tenant-safety(隔离)
.now() 依赖 JVM 默认时区场景: LocalDate.now() / LocalDateTime.now() / Instant.now() / new Date() 不传时区
LocalDate.now() 在 UTC 服务器上返回的"今天"比业务时区少 1 天(凌晨场景)LocalDateTime.now() 拿到的是 JVM 默认时区时间,docker base image 经常默认 UTC// ❌ 错误:依赖 JVM 默认时区
LocalDateTime weekStart = LocalDate.now()
.with(DayOfWeek.MONDAY)
.atStartOfDay();
// ❌ 错误:跨日切换的统计依赖默认时区
LocalDate today = LocalDate.now();
List<Order> todayOrders = orderRepository.findByCreatedAtAfter(today.atStartOfDay());
// ❌ 错误:Date 用默认时区
Date now = new Date();
项目级业务时区常量 + 所有 .now() 显式传入:
test cases passed, vs 17 / 22 without
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.