Skip to content
New issue

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

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

Already on GitHub? # to your account

localtime_r issue is back on latest api headers #1342

Closed
revelator opened this issue Apr 19, 2016 · 2 comments
Closed

localtime_r issue is back on latest api headers #1342

revelator opened this issue Apr 19, 2016 · 2 comments

Comments

@revelator
Copy link
Contributor

while trying to build the qt-5.6.0 package i ran into this.

tools/qdatetime.cpp: In function 'bool qt_localtime(qint64, QDate_, QTime_, QDateTimePrivate::DaylightStatus*)':
tools/qdatetime.cpp:2348:46: error: 'localtime_r' was not declared in this scope
res = localtime_r(&secsSinceEpoch, &local);
adiing -D_POSIX no longer works either since theres been some changes to time.h

if defined(_POSIX_C_SOURCE) && !defined(_POSIX_THREAD_SAFE_FUNCTIONS)

define _POSIX_THREAD_SAFE_FUNCTIONS 200112L

endif

ifdef _POSIX_THREAD_SAFE_FUNCTIONS

__forceinline struct tm *__cdecl localtime_r(const time_t *_Time, struct tm *_Tm) {
return localtime_s(_Tm, _Time) ? NULL : _Tm;
}
__forceinline struct tm *__cdecl gmtime_r(const time_t *_Time, struct tm *_Tm) {
return gmtime_s(_Tm, _Time) ? NULL : _Tm;
}
__forceinline char *__cdecl ctime_r(const time_t *_Time, char *_Str) {
return ctime_s(_Str, 0x7fffffff, _Time) ? NULL : _Str;
}
__forceinline char *__cdecl asctime_r(const struct tm *_Tm, char * _Str) {
return asctime_s(_Str, 0x7fffffff, _Tm) ? NULL : _Str;
}

endif

also there seems to be some other issues with the latest mingw-w64-headers + crt causing spurious build failures.

@revelator
Copy link
Contributor Author

Can get around this issue by supplying -D_POSIX_C_SOURCE to flags, latest version still bugs out on this one, so maybe helpfull to others.

@revelator
Copy link
Contributor Author

Damn seems this one keeps turning up with every update, im going to do a patch that either removes it completely or fixes it so that it works correctly.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants