Skip to content

Commit

Permalink
cunit/timeofday.c: intercept the 64-bit gettimeofday()
Browse files Browse the repository at this point in the history
This already worked correctly on 64-bit platforms, and on 32-bit platforms
with 32-bit time, but was broken on 32-bit platforms with 64-bit time.
  • Loading branch information
elliefm committed Apr 12, 2024
1 parent 40accb9 commit ee6f1dd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cunit/timeofday.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,13 @@ void time_restore(void)
/* call the real libc function */
static int real_gettimeofday(struct timeval *tv, ...)
{
#if defined(__USE_TIME_BITS64)
extern int __gettimeofday64(struct timeval *, ...);
return __gettimeofday64(tv, NULL);
#else
extern int __gettimeofday(struct timeval *, ...);
return __gettimeofday(tv, NULL);
#endif
}

/* provide a function to hide the libc weak alias */
Expand Down

0 comments on commit ee6f1dd

Please sign in to comment.