Skip to content

Commit

Permalink
Merge branch 'fixes' of github.com:Daedaluz/mosquitto into Daedaluz-f…
Browse files Browse the repository at this point in the history
…ixes
  • Loading branch information
ralight committed Mar 27, 2023
2 parents 103253d + 2e2a420 commit 6f61710
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/mosquitto.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ int mosquitto_lib_init(void)
srand((unsigned int)GetTickCount64());
#elif _POSIX_TIMERS>0 && defined(_POSIX_MONOTONIC_CLOCK)
struct timespec tp;

#ifdef CLOCK_BOOTTIME
clock_gettime(CLOCK_BOOTTIME, &tp);
#else
clock_gettime(CLOCK_MONOTONIC, &tp);
#endif
srand((unsigned int)tp.tv_nsec);
#elif defined(__APPLE__)
uint64_t ticks;
Expand Down
4 changes: 4 additions & 0 deletions lib/time_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ time_t mosquitto_time(void)
#elif _POSIX_TIMERS>0 && defined(_POSIX_MONOTONIC_CLOCK)
struct timespec tp;

#ifdef CLOCK_BOOTTIME
clock_gettime(CLOCK_BOOTTIME, &tp);
#else
clock_gettime(CLOCK_MONOTONIC, &tp);
#endif
return tp.tv_sec;
#elif defined(__APPLE__)
static mach_timebase_info_data_t tb;
Expand Down

0 comments on commit 6f61710

Please sign in to comment.