ocilib
ocilib copied to clipboard
mktime vs. mktime64
Hello Vincent,
Great works!
I am using libocilib on AIX platform (7.1) with Oracle 12c and I have a problem when I am using those functions: boolean OCI_API OCI_DateToCTime boolean OCI_API OCI_DateFromCTime boolean OCI_API OCI_TimestampToCTime boolean OCI_API OCI_TimestampFromCTime
All use "time_t" type and "*ToCTime" use 32 bits "mktime" function.
Type "time64_t" and "mktime64" use 64 bits integer and are compatible with dates before 1st of January 1970 and after 19 of January 2038, 03:14:07.
May be it is not possible to change API but can you add new functions or propose a configuration during the compilation?
Thanks
The problem is under AIX only who have two types "time_t" with 32 bits and "time64_t" with 64 bits. You can write something like this :
#ifdef _AIX
time64_t t;
#else
time_t t;
#endif
...
#ifdef _AIX
if (t == (time_64t)-1)
#else
if (t == (time_t)-1)
#endif
…
#ifdef _AIX
t = mktime64( &fieldDate );
#else
t = mktime( &fieldDate );
#endif
Regards
Hi Arnaud,
How are you doing? It's been a while :) 64bit version of time methods are not AIX specific but are avaible on all 64bit environments. I can try to do 64 bits detection in ocilib.h and use 32/64 versions of time methods but it breaks backward binary compatibility as OCI_xxxCtime methods signature would change. Thus, it shall not be performed within a patch version but rather in a major/minor version change. I will add your request in my do-to list for v4.4 (that will implement some nex 12cR2 features) but not for v4.3.3 (if any)
Best regarsds,
Vincent
Will be taken into account for v5.0.0
Closing this issue (5 years old) as it won't be addressed in a near future.