Repository navigation
Conversation
新增 `uvcpp_cron_schedule` + `uvcpp_cron`(`src/uvcpp/uvcpp_cron.*`): - 表达式:5 段(分 时 日 月 周)或 6 段(秒 分 时 日 月 周),支持 `*`、`n`、 `a-b`、`a-b/n`、逗号列表;越界/倒序/步长 0/段数不对一律解析失败并给原因, 不猜 `JAN`/`@daily`/`L/W/#` 这些扩展; - 时间基准 **UTC**(不读本机时区,容器/CI 里可复现); - 日与周同时受限时按 Vixie 语义取"或"(`0 0 13 * 5` = 13 号或周五); - `next_utc()` 严格晚于给定时刻,5 年上限内无解返回 false(`0 0 30 2 *`); - `uvcpp_cron` 绑一条 `uvcpp_loop`,每任务一个 `uvcpp_timer`;错过不补, 回调异常被吞掉并计 `stats().errors`,`start/stop/clear/stats` 齐全; - 解析与求下次时间是纯函数,可脱离循环单独用。 用例 `cron_func`:17 条解析(含 12 条非法)、UTC 匹配(周一/13 号或周五的 "或"语义)、`*/15` 跨刻、跨月、6 段下一秒、2 月 30 号无解,以及真 `uvcpp_loop` 上每秒触发的调度(正常任务 + 抛异常任务并行,errors/runs/jobs 对账)。文档 `doc/lowlevel-guide.md` §11。 本地 build-all 163/163、build-h3/default 编过;文档门禁全绿。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #72.
内容
新增
uvcpp_cron_schedule+uvcpp_cron(核心层,无外部依赖):*、n、a-b、a-b/n、逗号列表;越界/倒序/步长 0/段数不对 → 解析失败并给原因,不猜JAN/@daily/L/W/#;0 0 13 * 5= 13 号或周五;next_utc()严格晚于给定时刻;5 年上限内无解返回 false(0 0 30 2 *);uvcpp_cron绑一条uvcpp_loop,每任务一个uvcpp_timer;错过不补、回调异常被吞掉并计stats().errors;start/stop/clear/stats;用例
cron_func:next_utc:*/1510:07→10:15、跨月到 2/1 00:00、6 段下一秒、2 月 30 号无解;验证
build-all 163/163、build-h3 / build-default 编过;check_docs / check_doc_lines / check_doc_versions / check_ci_layout 全绿。文档
doc/lowlevel-guide.md§11。