Skip to content

[refactor][P3] timex.GetCurrentTime 返回 int——32 位平台 2038 截断 + 同族宽度口径漂移 #388

Closed

Description

@zy84338719

来源:2026-11-11 全矩阵深度代码审查(6 路并行扫描约 24 万行 Go)。判定已复核;行号基于 2026-11-11 的 main,动手前请核对现场。
归档索引:#372(本仓重构 backlog)

位置

pkg/timex/time.go:21-23(已人工复核)

证据

func GetCurrentTime() int {
    return int(time.Now().Unix())
}

同族其余全部 int64:GetCurrentDayStartTime(:36)返回 int64、Date2Stamp(:83)int64、StampInt2Date(:58)收 int64——唯独「当前时间戳」这个最高频入口是 int。GOARCH=386/arm(int=32 位)上 2038-01 起回绕为负,且该值常被拿来与 int64 时间戳比较/入库。

建议

返回值改 int64(对齐同族);如需保兼容加 GetCurrentTime64 并把旧函数 godoc 标注 32 位截断边界。顺带 TimestampString(:17) 的 fmt.Sprintf 分配面改 strconv.FormatInt。

Activity

  1. moved this from Todo to In Progress in oekit Issue 大盘on Nov 12, 2026
  2. added a commit that references this issue on Nov 12, 2026
  3. moved this from In Progress to Done in oekit Issue 大盘on Nov 12, 2026
  4. zy84338719 commented on Nov 12, 2026

    @zy84338719
    ContributorAuthor

    已合入修复 ✅(无 SemVer 发布:本次改动不发版本)

    变更内容

    timex.GetCurrentTime 返回 int64 对齐同族,32 位平台 2038 截断消除;TimestampString 改 strconv.FormatInt

    合入:PR #421(https://github.com/oekit/pkg/pull/421),merge commit 63917515,2026-11-12T17:10:03Z

    CI:link ✅ / Lint & Test / Test ✅ / Lint & Test / Lint ✅ / Zero Third-Party Deps ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactor重构机会(代码审查产出)

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions