Skip to content

Commit

Permalink
Remove obsolete Windows-specific time code paths
Browse files Browse the repository at this point in the history
  • Loading branch information
dscharrer committed Apr 16, 2014
1 parent a81006c commit 05de203
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 45 deletions.
14 changes: 1 addition & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,21 +180,9 @@ if(NOT INNOEXTRACT_HAVE_ISATTY)
check_symbol_exists(_isatty "io.h" INNOEXTRACT_HAVE_MS_ISATTY)
endif()
check_symbol_exists(ioctl "sys/ioctl.h" INNOEXTRACT_HAVE_IOCTL)
check_symbol_exists(_mkgmtime64 "time.h" INNOEXTRACT_HAVE_MKGMTIME64)
if(NOT INNOEXTRACT_HAVE_MKGMTIME64)
if(NOT WIN32)
check_symbol_exists(timegm "time.h" INNOEXTRACT_HAVE_TIMEGM)
if(NOT INNOEXTRACT_HAVE_TIMEGM)
check_symbol_exists(_mkgmtime "time.h" INNOEXTRACT_HAVE_MKGMTIME)
endif()
endif()
check_symbol_exists(_gmtime64_s "time.h" INNOEXTRACT_HAVE_GMTIME64_S)
if(NOT INNOEXTRACT_HAVE_GMTIME64_S)
check_symbol_exists(gmtime_r "time.h" INNOEXTRACT_HAVE_GMTIME_R)
if(NOT INNOEXTRACT_HAVE_GMTIME_R)
check_symbol_exists(gmtime_s "time.h" INNOEXTRACT_HAVE_GMTIME_S)
endif()
endif()
if(NOT WIN32)
check_symbol_exists(utimensat "sys/stat.h" INNOEXTRACT_HAVE_UTIMENSAT)
check_symbol_exists(AT_FDCWD "fcntl.h" INNOEXTRACT_HAVE_AT_FDCWD)
if(INNOEXTRACT_HAVE_UTIMENSAT AND INNOEXTRACT_HAVE_AT_FDCWD)
Expand Down
4 changes: 0 additions & 4 deletions src/configure.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@
#cmakedefine01 INNOEXTRACT_HAVE_IOCTL

// Time functions
#cmakedefine01 INNOEXTRACT_HAVE_MKGMTIME64
#cmakedefine01 INNOEXTRACT_HAVE_TIMEGM
#cmakedefine01 INNOEXTRACT_HAVE_MKGMTIME
#cmakedefine01 INNOEXTRACT_HAVE_GMTIME64_S
#cmakedefine01 INNOEXTRACT_HAVE_GMTIME_R
#cmakedefine01 INNOEXTRACT_HAVE_GMTIME_S

// File functions
#cmakedefine01 INNOEXTRACT_HAVE_UTIMENSAT
Expand Down
29 changes: 1 addition & 28 deletions src/util/time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

#include "configure.hpp"

#if INNOEXTRACT_HAVE_TIMEGM || INNOEXTRACT_HAVE_MKGMTIME \
|| INNOEXTRACT_HAVE_GMTIME_R || INNOEXTRACT_HAVE_GMTIME_S
#if INNOEXTRACT_HAVE_TIMEGM || INNOEXTRACT_HAVE_GMTIME_R
#include <time.h>
#endif

Expand Down Expand Up @@ -121,24 +120,12 @@ time parse_time(std::tm tm) {
}
return from_filetime(ft);

#elif INNOEXTRACT_HAVE_MKGMTIME64

// Windows

return _mkgmtime64(&tm);

#elif INNOEXTRACT_HAVE_TIMEGM

// GNU / BSD extension

return timegm(&tm);

#elif INNOEXTRACT_HAVE_MKGMTIME

// Windows (32-bit for MinGW32)

return _mkgmtime(&tm);

#else

// Standard, but not thread-safe - should be OK for our use though
Expand Down Expand Up @@ -194,27 +181,13 @@ std::tm format_time(time t) {
}
ret.tm_isdst = -1;

#elif INNOEXTRACT_HAVE_GMTIME64_S

// Windows

__time64_t tt = to_time_t<__time64_t>(t);
_gmtime64_s(&ret, &tt);

#elif INNOEXTRACT_HAVE_GMTIME_R

// POSIX.1

time_t tt = to_time_t<time_t>(t);
gmtime_r(&tt, &ret);

#elif INNOEXTRACT_HAVE_GMTIME_S

// Windows (MSVC)

time_t tt = to_time_t<time_t>(t);
gmtime_s(&ret, &tt);

#else

// Standard C++, but may not be thread-safe
Expand Down

0 comments on commit 05de203

Please sign in to comment.