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 Linux 32-bits encoded timestamp limitation - 2038K Bug #35

Open
wants to merge 1 commit into
base: omr1
Choose a base branch
from

Conversation

jeremy-compostella
Copy link
Contributor

Historically time_t has been encoded on Linux as 32-bits signed
integer and with Linux 32 bits <5.6 it is still encoded as a 32-bits
signed integer. As a consequence beyond January 2038 gettimeofday()
will start returning a negative timestamp and this negative timestamp
will be supplied to pthread_cond_timedwait() by MediaSDK. The Linux
kernel will detects the invalid timestamp and return -EINVAL making
MediaSDK unusable.

This patch makes use of the 'clock_gettime(CLOCK_MONOTONIC, ...)' to
get current time since boot and configure the condition variable to
use the same clock.

Since this patch only impact the timestamped used for the
pthread_cond_timedwait() calls it has no impact in the other
components.

Signed-off-by: Jeremy Compostella [email protected]

@jeremy-compostella
Copy link
Contributor Author

This need to be fixed on all the branches and the original project too. Let's do the patch review on this particular branch of interest for me. Once this is merged, I will port to the other branches and also the https://github.com/Intel-Media-SDK/MediaSDK project and submit the pull requests.

@jeremy-compostella
Copy link
Contributor Author

Thank you for approving this pull request. I got a similar patch merged into the Intel MediaSDK project Intel-Media-SDK/MediaSDK@f3f9e03.

@jeremy-compostella
Copy link
Contributor Author

This issue is on all version of MediaSDK. Which branches do you need a pull request for ?

@LukeZheZhu
Copy link
Contributor

Hi Jeremy,
Thanks for your patch. I have cherry-picked your patch from Intel-Media-SDK/MediaSDK@f3f9e03 to other projectceladon branches.

BTW, please add 'Tracked-On: OAM-92928' at the end of your commit message, so that I can merge it.
Thank you so much.

Historically time_t has been encoded on Linux as 32-bits signed
integer and with Linux 32 bits <5.6 it is still encoded as a 32-bits
signed integer. As a consequence beyond January 2038 gettimeofday()
will start returning a negative timestamp and this negative timestamp
will be supplied to pthread_cond_timedwait() by MediaSDK. The Linux
kernel will detects the invalid timestamp and return -EINVAL making
MediaSDK unusable.

This patch makes use of the 'clock_gettime(CLOCK_MONOTONIC, ...)' to
get current time since boot and configure the condition variable to
use the same clock.

Since this patch only impact the timestamped used for the
pthread_cond_timedwait() calls it has no impact in the other
components.

Tracked-On: OAM-92928
Signed-off-by: Jeremy Compostella <[email protected]>
@jeremy-compostella
Copy link
Contributor Author

BTW, please add 'Tracked-On: OAM-92928' at the end of your commit message, so that I can merge it.
Thank you so much.
Done.

@sysopenci sysopenci added the Stale Stale label for inactive open prs label Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Stale label for inactive open prs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants