Feature #556
timegm() function should work with Windows 64bit time_t
100%
Description
In timegm.h, it defines _USE_32BIT_TIME_T because the comments say that the 64 bit time_t does not work:
/* Visual Studio C++ 2005 (8.0) uses 64 bit time_t, which doesn't work */
#if defined _MSC_VER && _MSC_VER >= 1400
- define _USE_32BIT_TIME_T
#endif
However, when performing a 64 bit build in Visual Studio 2008, crtdefs.h says that _USE_32BIT_TIME_T is not valid with WIN64:
#ifdef _USE_32BIT_TIME_T
#ifdef _WIN64
#error You cannot use 32-bit time_t (_USE_32BIT_TIME_T) with _WIN64
#undef _USE_32BIT_TIME_T
#endif
#endif
Associated revisions
History
Updated by Andreas Huggel over 13 years ago
From Wade Peeler, AccessData:
MSVC has a similar function, but named differently: _mkgmtime(). It will adjust to the correct call depending on the build settings (_mkgmtime32() or _mkgmtime64()):
Converts a UTC time represented by a tm struct to a UTC time represented by a time_t type.
time_t _mkgmtime(
struct tm* timeptr
);
__time32_t _mkgmtime32(
struct tm* timeptr
);
__time64_t _mkgmtime64(
struct tm* timeptr
);
Updated by Andreas Huggel over 12 years ago
- Target version changed from 1.0 to 0.18.2
- % Done changed from 0 to 100
#556 timegm() function should work with Windows 64bit time_t
Fix submitted.
1) Removed _USE_32BIT_TIME_T from code base.
2) Added a macro to replace timegm() with _mkgmtime() on VC8+ (supports 32 and 64 bit time_t)
Simple test performed on VC 7.1/8 and 9 (VS 2003/05/08)
C:\gnu\exiv2\msvc\bin\Release>exiv2 -a 1:00:00 ad \R.tiff && exiv2 -pt \R.tiff | grep DateTimeOriginal
Exif.Photo.DateTimeOriginal Ascii 20 2009:04:26 10:38:18
C:\gnu\exiv2\msvc\bin\Release>exiv2 -a 1:00:00 ad \R.tiff && exiv2 -pt \R.tiff | grep -i time
Exif.Image.DateTimeOriginal Ascii 20 2009:04:26 11:38:18
C:\gnu\exiv2\msvc\bin\Release>
3) Cosmetic fix to basicio.cpp
Fixed nasty little <tab> I missed when I committed basicio.cpp on Sunday (apologies)