Skip to content

time cross platform#365

Merged
yixy-only merged 2 commits into
x-ege:masterfrom
pointertobios:feature/time-cross-platform
Jun 29, 2026
Merged

time cross platform#365
yixy-only merged 2 commits into
x-ege:masterfrom
pointertobios:feature/time-cross-platform

Conversation

@pointertobios

@pointertobios pointertobios commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

整个src中没有对get_highfeq_time_start的其它引用,可以安全地删除
运行所有demo都没发现有问题

Summary by CodeRabbit

  • 新功能
    • 计时与延时逻辑升级为统一的高精度时间方案,提升时间计算的一致性与稳定性。
  • 改进
    • 帧率统计及多种延时流程改为使用同一计时基准,减少对内部设置状态的依赖。
    • 当延时为 0 时,改为更符合系统调度的让出式等待策略,优化空闲时的 CPU 行为。

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 70110824-af1a-443b-b1fd-c27425318707

📥 Commits

Reviewing files that changed from the base of the PR and between a6b45a5 and c37e1f6.

📒 Files selected for processing (4)
  • src/ege_head.h
  • src/ege_time.h
  • src/egegapi.cpp
  • src/time.cpp
💤 Files with no reviewable changes (1)
  • src/ege_head.h
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/ege_time.h
  • src/time.cpp
  • src/egegapi.cpp

Walkthrough

get_highfeq_time_ls 改为无参的 std::chrono 实现,并同步移除相关结构体字段、更新头文件声明、帧率统计调用点以及延时逻辑中的计时与等待方式。

Changes

计时函数重构

Layer / File(s) Summary
公共声明与结构体成员移除
src/ege_head.h, src/ege_time.h
_graph_setting 移除 LARGE_INTEGER get_highfeq_time_start 成员;将 get_highfeq_time_ls 声明改为无参版本并移除 _graph_setting 前置声明。
计时实现与延时调用更新
src/time.cpp
新增 <chrono>/<thread>;将 get_highfeq_time_ls 重写为基于 steady_clock 的无参实现;ege_sleepdelay_msdelay_fpsdelay_jfps 的计时与等待逻辑改为无参调用,并将 Sleep(0) 改为 yield
帧率统计调用点更新
src/egegapi.cpp
updateFrameRate 中的 currentTime 初始化改为无参 get_highfeq_time_ls()

Sequence Diagram(s)

sequenceDiagram
  participant ComponentA
  participant ComponentB
  ComponentA->>ComponentB: observable interaction
Loading

估计代码审查工作量

🎯 3 (Moderate) | ⏱️ ~20 minutes

可能相关的 PR

  • x-ege/xege#257:同样涉及 updateFrameRatedelay_ms 与帧率/延时计时路径的调整。

小诗

🐰 小兔子敲响新时钟,
旧指针悄悄不再用;
chrono 轻步向前跳,
yieldsleep_for 同行;
秒针落在静起点,
代码清爽咕噜噜转。

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题与变更主题一致,概括了计时相关代码的跨平台改造。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/time.cpp`:
- Around line 185-189: The timing baseline in the time utility uses
high_resolution_clock, which may not be monotonic and can break
delay_fps/delay_jfps behavior if system time changes. Update the logic in the
time-related function that defines start_time_point and computes durationTime to
use std::chrono::steady_clock consistently for both the stored start point and
the current timestamp, so frame pacing and FPS measurements are based on a
stable clock.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 05875eb0-ce51-45b3-b3f9-aae2cb71e875

📥 Commits

Reviewing files that changed from the base of the PR and between 9df93f6 and a6b45a5.

📒 Files selected for processing (4)
  • src/ege_head.h
  • src/ege_time.h
  • src/egegapi.cpp
  • src/time.cpp
💤 Files with no reviewable changes (1)
  • src/ege_head.h

Comment thread src/time.cpp
@yixy-only yixy-only force-pushed the feature/time-cross-platform branch from ac4a8db to c37e1f6 Compare June 29, 2026 16:42
@yixy-only yixy-only merged commit 768ad26 into x-ege:master Jun 29, 2026
15 of 19 checks passed
@pointertobios pointertobios deleted the feature/time-cross-platform branch June 30, 2026 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants