diff --git a/configure b/configure index a5516fe60eb..b652ddbf79a 100755 --- a/configure +++ b/configure @@ -7418,7 +7418,6 @@ for ac_header in \ mach/mach.h \ mach/machine.h \ machine/cpu.h \ - machine/limits.h \ machine/sysarch.h \ mntent.h \ ncurses.h \ @@ -7448,7 +7447,6 @@ for ac_header in \ sys/filio.h \ sys/ioctl.h \ sys/ipc.h \ - sys/limits.h \ sys/link.h \ sys/mman.h \ sys/modem.h \ @@ -17984,7 +17982,6 @@ for ac_func in \ sysinfo \ tcdrain \ thr_kill2 \ - timegm \ usleep do : diff --git a/configure.ac b/configure.ac index b43ec739294..c0f60fe694a 100644 --- a/configure.ac +++ b/configure.ac @@ -473,7 +473,6 @@ AC_CHECK_HEADERS(\ mach/mach.h \ mach/machine.h \ machine/cpu.h \ - machine/limits.h \ machine/sysarch.h \ mntent.h \ ncurses.h \ @@ -503,7 +502,6 @@ AC_CHECK_HEADERS(\ sys/filio.h \ sys/ioctl.h \ sys/ipc.h \ - sys/limits.h \ sys/link.h \ sys/mman.h \ sys/modem.h \ @@ -2217,7 +2215,6 @@ AC_CHECK_FUNCS(\ sysinfo \ tcdrain \ thr_kill2 \ - timegm \ usleep ) CFLAGS="$ac_save_CFLAGS" diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c index 4f25331a89e..29dd5791af4 100644 --- a/dlls/kernel32/file.c +++ b/dlls/kernel32/file.c @@ -407,6 +407,55 @@ BOOL WINAPI KERNEL32_FlushFileBuffers( HANDLE file ) } +/*********************************************************************** + * DosDateTimeToFileTime (KERNEL32.@) + */ +BOOL WINAPI DosDateTimeToFileTime( WORD fatdate, WORD fattime, FILETIME *ft ) +{ + TIME_FIELDS fields; + LARGE_INTEGER time; + + fields.Year = (fatdate >> 9) + 1980; + fields.Month = ((fatdate >> 5) & 0x0f); + fields.Day = (fatdate & 0x1f); + fields.Hour = (fattime >> 11); + fields.Minute = (fattime >> 5) & 0x3f; + fields.Second = (fattime & 0x1f) * 2; + fields.Milliseconds = 0; + if (!RtlTimeFieldsToTime( &fields, &time )) return FALSE; + ft->dwLowDateTime = time.u.LowPart; + ft->dwHighDateTime = time.u.HighPart; + return TRUE; +} + + +/*********************************************************************** + * FileTimeToDosDateTime (KERNEL32.@) + */ +BOOL WINAPI FileTimeToDosDateTime( const FILETIME *ft, WORD *fatdate, WORD *fattime ) +{ + TIME_FIELDS fields; + LARGE_INTEGER time; + + if (!fatdate || !fattime) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } + time.u.LowPart = ft->dwLowDateTime; + time.u.HighPart = ft->dwHighDateTime; + RtlTimeToTimeFields( &time, &fields ); + if (fields.Year < 1980) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } + *fattime = (fields.Hour << 11) + (fields.Minute << 5) + (fields.Second / 2); + *fatdate = ((fields.Year - 1980) << 9) + (fields.Month << 5) + fields.Day; + return TRUE; +} + + /************************************************************************** * Operations on file names * **************************************************************************/ diff --git a/dlls/kernel32/time.c b/dlls/kernel32/time.c index 4b959684c68..94ccbfb2b9b 100644 --- a/dlls/kernel32/time.c +++ b/dlls/kernel32/time.c @@ -30,14 +30,6 @@ #ifdef HAVE_SYS_TIME_H # include #endif -#ifdef HAVE_SYS_TIMES_H -# include -#endif -#ifdef HAVE_SYS_LIMITS_H -#include -#elif defined(HAVE_MACHINE_LIMITS_H) -#include -#endif #include "ntstatus.h" #define WIN32_NO_STATUS @@ -116,66 +108,6 @@ BOOL WINAPI GetDaylightFlag(void) return GetTimeZoneInformation( &tzinfo) == TIME_ZONE_ID_DAYLIGHT; } -/*********************************************************************** - * DosDateTimeToFileTime (KERNEL32.@) - */ -BOOL WINAPI DosDateTimeToFileTime( WORD fatdate, WORD fattime, LPFILETIME ft) -{ - struct tm newtm; -#ifndef HAVE_TIMEGM - struct tm *gtm; - time_t time1, time2; -#endif - - newtm.tm_sec = (fattime & 0x1f) * 2; - newtm.tm_min = (fattime >> 5) & 0x3f; - newtm.tm_hour = (fattime >> 11); - newtm.tm_mday = (fatdate & 0x1f); - newtm.tm_mon = ((fatdate >> 5) & 0x0f) - 1; - newtm.tm_year = (fatdate >> 9) + 80; - newtm.tm_isdst = -1; -#ifdef HAVE_TIMEGM - RtlSecondsSince1970ToTime( timegm(&newtm), (LARGE_INTEGER *)ft ); -#else - time1 = mktime(&newtm); - gtm = gmtime(&time1); - time2 = mktime(gtm); - RtlSecondsSince1970ToTime( 2*time1-time2, (LARGE_INTEGER *)ft ); -#endif - return TRUE; -} - - -/*********************************************************************** - * FileTimeToDosDateTime (KERNEL32.@) - */ -BOOL WINAPI FileTimeToDosDateTime( const FILETIME *ft, LPWORD fatdate, - LPWORD fattime ) -{ - LARGE_INTEGER li; - ULONG t; - time_t unixtime; - struct tm* tm; - - if (!fatdate || !fattime) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - li.u.LowPart = ft->dwLowDateTime; - li.u.HighPart = ft->dwHighDateTime; - if (!RtlTimeToSecondsSince1970( &li, &t )) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - unixtime = t; - tm = gmtime( &unixtime ); - *fattime = (tm->tm_hour << 11) + (tm->tm_min << 5) + (tm->tm_sec / 2); - *fatdate = ((tm->tm_year - 80) << 9) + ((tm->tm_mon + 1) << 5) + tm->tm_mday; - return TRUE; -} - /****************************************************************************** * GetTickCount64 (KERNEL32.@) */ diff --git a/include/config.h.in b/include/config.h.in index 26424873129..720cbd4a5d9 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -539,9 +539,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MACHINE_CPU_H -/* Define to 1 if you have the header file. */ -#undef HAVE_MACHINE_LIMITS_H - /* Define to 1 if you have the header file. */ #undef HAVE_MACHINE_SYSARCH_H @@ -1021,9 +1018,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IPC_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_LIMITS_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_LINK_H @@ -1162,9 +1156,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_TIFFIO_H -/* Define to 1 if you have the `timegm' function. */ -#undef HAVE_TIMEGM - /* Define to 1 if you have the `trunc' function. */ #undef HAVE_TRUNC