-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
[PVR] Fix time_t db insertion (typecast time_t -> uint) #12069
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there a better modifier we could use to avoid casting everywhere?
Wondering why not every win32 build user experiences those crashes/stalls? Some of the affected functions should be called unconditionally as soon as pvr is enabled. |
AFAIK there is no format specifier for time_t. But yes, @ksooo I was also surprised about the heavy crashes I never realized before. Behavier is currently (empty dp):
Could be that I use a newer WinSDK than on jenkins build machine and time_t has changed. @Jalle19 what is your objection regarding type-casts?
|
Just to avoid a long discussion:
So it has to be changed in any way, solution one the typecast as done in the commit, solution 2: change the datatypes / return values of the function to unsigned int instead time_t., solution 3: use std::stringstream for formatting. We only have to decide to one of those 3. |
|
thanx for sorting this out @Rechi Solution 4:) Introduce an |
I think we should avoid casting to 32bit,won't be an issue until 2038 but it would feel cleaner to cast to uint64_t everywhere |
I also think there is a better solution then casting. |
We have a platform specific define (PRIu64) for unsigned long long (64bit) formatting. |
BTW we should think about to drop the time_t here and use our datetime class and datetime sql type as we do it in our video db. |
+1 |
@Rechi I thought a time_t was unsigned but yeah in that case I don't have any objections really. |
Can we pls. agree to one of both: 1.) leave the PR as it is (90 years safe)
(Safe until end of everything but needs a new db schema) Does anyone of us believe that we'll have live-tv in 90 years? |
I'm fine with both although version 2 (no casting) is my preferred one. |
version 2 needs casting in the other direction. |
Just seen it, pick the version you prefer. |
I'm fine with option 1, merge the PR as it is now. |
For history: Dear people that come to this world after us. If you find that commit and it bites you in the ass, sit down, drink a beer and be happy that this part of the code survived that long. |
jenkins build this please |
[PVR] Fix time_t db insertion (typecast time_t -> uint)
Description
Win32's time_t is 64 bit, %u for time_t fails in epg and channel insertion with my win32 build.
This PR typecasts the time_t values used into the type expected in formatting string.
Motivation and Context
Fix crash on EPG update / pvr stall at kodi startup
Types of change
ping @ksooo