-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix CLOCK_BOOTTIME use on kernels not having it
When the libc headers used to build mosquitto define CLOCK_BOOTTIME but the kernel where mosquitto runs does not implement CLOCK_BOOTTIME, all timestamps are wrong (uninitialized data), because there is no check for the success of the clock_gettime() calls. This adds probing for the availability of CLOCK_BOOTTIME from mosquitto_lib_init(), falling back to CLOCK_MONOTONIC, and then modifies mosquitto_time() to use the selected clock. Probing at init time avoids having to do two clock_gettime() calls for every timestamp if CLOCK_BOOTTIME is not available. It also fixes a similar problem in mosquitto_lib_init(). Signed-off-by: Diego Santa Cruz <[email protected]>
- Loading branch information
1 parent
a87b5ff
commit 688fa86
Showing
3 changed files
with
30 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters