Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #844, switch to use CLOCK_REALTIME #937

Merged
merged 1 commit into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/os/portable/os-impl-posix-gettime.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
* The OS-specific code must \#include the correct headers that define the
* prototypes for these functions before including this implementation file.
*
* NOTE: The OS-specific header must also define which POSIX clock ID to use -
* this specifies the clockid_t parameter to use with clock_gettime(). In
* most cases this should be CLOCK_REALTIME to allow the clock to be set, and
* so the application will also see any manual/administrative clock changes.
*
* The clock ID is selected by defining the #OSAL_GETTIME_SOURCE_CLOCK macro.
*/

/****************************************************************************************
Expand Down
8 changes: 7 additions & 1 deletion src/os/posix/inc/os-impl-gettime.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
#include "osconfig.h"
#include <time.h>

#define OSAL_GETTIME_SOURCE_CLOCK CLOCK_MONOTONIC
/**
* \brief Idenfies the clock ID for OSAL clock operations on POSIX
*
* This is the POSIX clock ID that will be used to implement
* OS_GetLocalTime() and OS_SetLocalTime().
*/
#define OSAL_GETTIME_SOURCE_CLOCK CLOCK_REALTIME

#endif /* OS_IMPL_GETTIME_H */
8 changes: 7 additions & 1 deletion src/os/rtems/inc/os-impl-gettime.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
#include "osconfig.h"
#include <time.h>

#define OSAL_GETTIME_SOURCE_CLOCK CLOCK_MONOTONIC
/**
* \brief Idenfies the clock ID for OSAL clock operations on RTEMS
*
* This is the POSIX clock ID that will be used to implement
* OS_GetLocalTime() and OS_SetLocalTime().
*/
#define OSAL_GETTIME_SOURCE_CLOCK CLOCK_REALTIME

#endif /* OS_IMPL_GETTIME_H */
8 changes: 7 additions & 1 deletion src/os/vxworks/inc/os-impl-gettime.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
#include "osconfig.h"
#include <time.h>

#define OSAL_GETTIME_SOURCE_CLOCK CLOCK_MONOTONIC
/**
* \brief Idenfies the clock ID for OSAL clock operations on VxWorks
*
* This is the POSIX clock ID that will be used to implement
* OS_GetLocalTime() and OS_SetLocalTime().
*/
#define OSAL_GETTIME_SOURCE_CLOCK CLOCK_REALTIME

#endif /* OS_IMPL_GETTIME_H */