Skip to content

Commit

Permalink
LibC: Avoid write-back of unused value
Browse files Browse the repository at this point in the history
This might make sleep() faster by up to pi nanoseconds, or less.
It's more about avoiding a senseless write than about optimization.
  • Loading branch information
BenWiederhake authored and awesomekling committed Sep 12, 2020
1 parent be1e4f2 commit 8280dcf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/LibC/unistd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ char* getwd(char* buf)
int sleep(unsigned seconds)
{
struct timespec ts = { seconds, 0 };
if (clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts) < 0)
if (clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, nullptr) < 0)
return ts.tv_sec;
return 0;
}
Expand Down

0 comments on commit 8280dcf

Please sign in to comment.