From 58a79a2e4ef8131e025f7a502f3ab9806cc57695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Fri, 2 Oct 2026 19:22:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D(=E8=AE=A1=E8=B4=B9):=20?= =?UTF-8?q?=E5=8C=97=E4=BA=AC=E6=9C=AC=E5=9C=B0=E6=97=B6=E9=97=B4=E6=8D=A2?= =?UTF-8?q?=E7=AE=97=E6=A0=A1=E9=AA=8C=E5=BD=93=E6=97=A5=E6=97=B6=E5=88=BB?= =?UTF-8?q?=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit beijing_local_micros 增加 time_of_day_micros 越界即返回 0 的校验,避免越界时刻被解释成另一天 Co-authored-by: Junie --- server-rs/crates/module-runtime/src/membership/cycle.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server-rs/crates/module-runtime/src/membership/cycle.rs b/server-rs/crates/module-runtime/src/membership/cycle.rs index 4ac059a73..700a6cd95 100644 --- a/server-rs/crates/module-runtime/src/membership/cycle.rs +++ b/server-rs/crates/module-runtime/src/membership/cycle.rs @@ -20,9 +20,13 @@ pub fn beijing_local_date_parts(micros: i64) -> (i32, u8, u8, i64) { (year, month, day, time_of_day_micros) } -/// 北京时间本地年月日 + 当日已过微秒 → UTC 微秒时间戳;本地日期不存在时返回 0。 +/// 北京时间本地年月日 + 当日已过微秒 → UTC 微秒时间戳;本地日期或当日时刻越界时返回 0。 pub fn beijing_local_micros(year: i32, month: u8, day: u8, time_of_day_micros: i64) -> i64 { - if !(1..=12).contains(&month) || day == 0 || day > days_in_month(year, month) { + if !(1..=12).contains(&month) + || day == 0 + || day > days_in_month(year, month) + || !(0..PROFILE_RUNTIME_DAY_MICROS).contains(&time_of_day_micros) + { return 0; } days_from_civil(year, month, day)