portable way to deal with 64/32 bit time_t
Posted
by MK
on Stack Overflow
See other posts from Stack Overflow
or by MK
Published on 2010-03-18T03:39:01Z
Indexed on
2010/03/18
3:41 UTC
Read the original article
Hit count: 185
I have some code which is built both on Windows and Linux. Linux at this point is always 32bit but Windows is 32 and 64bit. Windows wants to have time_t be 64 bit and Linux still has it as 32 bit. I'm fine with that, except in some places time_t values are converted to strings. So when time_T is 32 bit it should be done with %d and when it is 64bit with %lld... what is the smart way to do this? Also: any ideas how I may find all places where time_t's are passed to printf-style functions to address this issue?
© Stack Overflow or respective owner