Skip to content

Commit

Permalink
Fix bug where clock_gettime calls itself recursively
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryptogenic committed Dec 21, 2021
1 parent d148a96 commit bdb43a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/time/clock_gettime.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ static void *volatile vdso_func = (void *)cgt_init;

#endif

#ifndef PS4
int __clock_gettime(clockid_t clk, struct timespec *ts)
{
int r;
Expand Down Expand Up @@ -109,3 +110,4 @@ int __clock_gettime(clockid_t clk, struct timespec *ts)
}

weak_alias(__clock_gettime, clock_gettime);
#endif
4 changes: 4 additions & 0 deletions src/time/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
time_t time(time_t *t)
{
struct timespec ts;
#ifndef PS4
__clock_gettime(CLOCK_REALTIME, &ts);
#else
clock_gettime(CLOCK_REALTIME, &ts);
#endif
if (t) *t = ts.tv_sec;
return ts.tv_sec;
}

0 comments on commit bdb43a0

Please sign in to comment.