Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix usage of clock and CLOCKS_PER_SEC #590

Merged
merged 3 commits into from
Apr 6, 2024
Merged

Conversation

fjtrujy
Copy link
Member

@fjtrujy fjtrujy commented Apr 6, 2024

Description

After fixing the implementation of clock(), now it returns values in microseconds, so now we need to make some adjustments.

Before mergin this PR we need to merge first ps2dev/newlib#12

@@ -637,7 +637,7 @@ int _gettimeofday(struct timeval *tv, struct timezone *tz)

#ifdef F__times
clock_t _times(struct tms *buffer) {
clock_t clk = GetTimerSystemTime() / (kBUSCLK / CLOCKS_PER_SEC);
Copy link
Member Author

Choose a reason for hiding this comment

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

Even being the same value, I think that using CLOCKS_PER_SEC could be "confusing"

@@ -36,7 +36,7 @@ int main(int argc, char *argv[])
struct timespec tv = {0};
tv.tv_sec = 1;
tv.tv_nsec = 0;
error_tolerance = 5; // 5 miliseconds of error tolerance
error_tolerance = 200; // 200 miliseconds of error tolerance
Copy link
Member Author

Choose a reason for hiding this comment

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

There is room for improvement in the timer, we should be more accurate.

@uyjulian uyjulian merged commit 895c900 into ps2dev:master Apr 6, 2024
9 checks passed
@fjtrujy fjtrujy deleted the fix_clock branch April 8, 2024 19:50
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