Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kugelfuhr
Copy link
Contributor

Looking at #2511 I noticed that the time() function could be improved and that it doesn't always work as it should.

When the underlying clock_gettime() function returns an error, the existing implementation would return (time_t)-1 but didn't store this value into *timep as is required by the standard.

So this change ...

  • ... fixes the error and will causes time() to always return identical numbers for the return value and *timep.
  • ... reduces the code size by 7 bytes.
  • ... doesn't use ldeaxi which may lead to additional size decreases depending on the program.
  • ... adds a test.

- When the underlying clock_gettime function returned an error, the value
  returned via *timep was wrong.
- Reduced code size by 7 bytes.
- Don't suck in ldeaxi.
@mrdudz
Copy link
Contributor

mrdudz commented Sep 13, 2024

thanks!

@mrdudz mrdudz merged commit 34d8c3e into cc65:master Sep 13, 2024
2 checks passed
@kugelfuhr kugelfuhr deleted the kugelfuhr/time-improvements branch June 12, 2025 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants