- Fixed GetSystemTimeAdjustment prototype and added it to winbase.h.
- Fixed DosDateTimeToFileTime, FileTimeToDosDateTime, LocalFileTimeToFileTime, FileTimeToLocalFileTime and SystemTimeToFileTime.
This commit is contained in:
parent
13b0dc5fde
commit
a032277311
|
@ -353,12 +353,11 @@ BOOL WINAPI SetLocalTime(
|
||||||
* BUGS
|
* BUGS
|
||||||
*
|
*
|
||||||
* Only the special case of disabled time adjustments is supported.
|
* Only the special case of disabled time adjustments is supported.
|
||||||
* (also the signature is wrong it should have a return type of BOOL)
|
|
||||||
*/
|
*/
|
||||||
DWORD WINAPI GetSystemTimeAdjustment(
|
BOOL WINAPI GetSystemTimeAdjustment(
|
||||||
LPDWORD lpTimeAdjustment, /* [out] The clock adjustment per interupt in 100's of nanoseconds. */
|
PDWORD lpTimeAdjustment, /* [out] The clock adjustment per interupt in 100's of nanoseconds. */
|
||||||
LPDWORD lpTimeIncrement, /* [out] The time between clock interupts in 100's of nanoseconds. */
|
PDWORD lpTimeIncrement, /* [out] The time between clock interupts in 100's of nanoseconds. */
|
||||||
LPBOOL lpTimeAdjustmentDisabled) /* [out] The clock synchonisation has been disabled. */
|
PBOOL lpTimeAdjustmentDisabled) /* [out] The clock synchonisation has been disabled. */
|
||||||
{
|
{
|
||||||
*lpTimeAdjustment = 0;
|
*lpTimeAdjustment = 0;
|
||||||
*lpTimeIncrement = 0;
|
*lpTimeIncrement = 0;
|
||||||
|
|
|
@ -2126,6 +2126,10 @@ INT WINAPI MulDiv(
|
||||||
BOOL WINAPI DosDateTimeToFileTime( WORD fatdate, WORD fattime, LPFILETIME ft)
|
BOOL WINAPI DosDateTimeToFileTime( WORD fatdate, WORD fattime, LPFILETIME ft)
|
||||||
{
|
{
|
||||||
struct tm newtm;
|
struct tm newtm;
|
||||||
|
#ifndef HAVE_TIMEGM
|
||||||
|
struct tm *gtm;
|
||||||
|
time_t time1, time2;
|
||||||
|
#endif
|
||||||
|
|
||||||
newtm.tm_sec = (fattime & 0x1f) * 2;
|
newtm.tm_sec = (fattime & 0x1f) * 2;
|
||||||
newtm.tm_min = (fattime >> 5) & 0x3f;
|
newtm.tm_min = (fattime >> 5) & 0x3f;
|
||||||
|
@ -2133,7 +2137,14 @@ BOOL WINAPI DosDateTimeToFileTime( WORD fatdate, WORD fattime, LPFILETIME ft)
|
||||||
newtm.tm_mday = (fatdate & 0x1f);
|
newtm.tm_mday = (fatdate & 0x1f);
|
||||||
newtm.tm_mon = ((fatdate >> 5) & 0x0f) - 1;
|
newtm.tm_mon = ((fatdate >> 5) & 0x0f) - 1;
|
||||||
newtm.tm_year = (fatdate >> 9) + 80;
|
newtm.tm_year = (fatdate >> 9) + 80;
|
||||||
RtlSecondsSince1970ToTime( mktime( &newtm ), ft );
|
#ifdef HAVE_TIMEGM
|
||||||
|
RtlSecondsSince1970ToTime( timegm(&newtm), ft );
|
||||||
|
#else
|
||||||
|
time1 = mktime(&newtm);
|
||||||
|
gtm = gmtime(&time1);
|
||||||
|
time2 = mktime(gtm);
|
||||||
|
RtlSecondsSince1970ToTime( 2*time1-time2, ft );
|
||||||
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2145,7 +2156,7 @@ BOOL WINAPI FileTimeToDosDateTime( const FILETIME *ft, LPWORD fatdate,
|
||||||
LPWORD fattime )
|
LPWORD fattime )
|
||||||
{
|
{
|
||||||
time_t unixtime = DOSFS_FileTimeToUnixTime( ft, NULL );
|
time_t unixtime = DOSFS_FileTimeToUnixTime( ft, NULL );
|
||||||
struct tm *tm = localtime( &unixtime );
|
struct tm *tm = gmtime( &unixtime );
|
||||||
if (fattime)
|
if (fattime)
|
||||||
*fattime = (tm->tm_hour << 11) + (tm->tm_min << 5) + (tm->tm_sec / 2);
|
*fattime = (tm->tm_hour << 11) + (tm->tm_min << 5) + (tm->tm_sec / 2);
|
||||||
if (fatdate)
|
if (fatdate)
|
||||||
|
@ -2163,11 +2174,14 @@ BOOL WINAPI LocalFileTimeToFileTime( const FILETIME *localft,
|
||||||
{
|
{
|
||||||
struct tm *xtm;
|
struct tm *xtm;
|
||||||
DWORD remainder;
|
DWORD remainder;
|
||||||
|
time_t utctime;
|
||||||
|
|
||||||
/* convert from local to UTC. Perhaps not correct. FIXME */
|
/* Converts from local to UTC. */
|
||||||
time_t unixtime = DOSFS_FileTimeToUnixTime( localft, &remainder );
|
time_t localtime = DOSFS_FileTimeToUnixTime( localft, &remainder );
|
||||||
xtm = gmtime( &unixtime );
|
xtm = gmtime( &localtime );
|
||||||
DOSFS_UnixTimeToFileTime( mktime(xtm), utcft, remainder );
|
utctime = mktime(xtm);
|
||||||
|
if(xtm->tm_isdst > 0) utctime-=3600;
|
||||||
|
DOSFS_UnixTimeToFileTime( utctime, utcft, remainder );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2179,7 +2193,7 @@ BOOL WINAPI FileTimeToLocalFileTime( const FILETIME *utcft,
|
||||||
LPFILETIME localft )
|
LPFILETIME localft )
|
||||||
{
|
{
|
||||||
DWORD remainder;
|
DWORD remainder;
|
||||||
/* convert from UTC to local. Perhaps not correct. FIXME */
|
/* Converts from UTC to local. */
|
||||||
time_t unixtime = DOSFS_FileTimeToUnixTime( utcft, &remainder );
|
time_t unixtime = DOSFS_FileTimeToUnixTime( utcft, &remainder );
|
||||||
#ifdef HAVE_TIMEGM
|
#ifdef HAVE_TIMEGM
|
||||||
struct tm *xtm = localtime( &unixtime );
|
struct tm *xtm = localtime( &unixtime );
|
||||||
|
@ -2189,14 +2203,13 @@ BOOL WINAPI FileTimeToLocalFileTime( const FILETIME *utcft,
|
||||||
DOSFS_UnixTimeToFileTime( localtime, localft, remainder );
|
DOSFS_UnixTimeToFileTime( localtime, localft, remainder );
|
||||||
|
|
||||||
#else
|
#else
|
||||||
struct tm *xtm,*gtm;
|
struct tm *xtm;
|
||||||
time_t time1,time2;
|
time_t time;
|
||||||
|
|
||||||
xtm = localtime( &unixtime );
|
xtm = gmtime( &unixtime );
|
||||||
gtm = gmtime( &unixtime );
|
time = mktime(xtm);
|
||||||
time1 = mktime(xtm);
|
if(xtm->tm_isdst > 0) time-=3600;
|
||||||
time2 = mktime(gtm);
|
DOSFS_UnixTimeToFileTime( 2*unixtime-time, localft, remainder );
|
||||||
DOSFS_UnixTimeToFileTime( 2*time1-time2, localft, remainder );
|
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -2291,7 +2304,7 @@ BOOL WINAPI SystemTimeToFileTime( const SYSTEMTIME *syst, LPFILETIME ft )
|
||||||
struct tm xtm;
|
struct tm xtm;
|
||||||
time_t utctime;
|
time_t utctime;
|
||||||
#else
|
#else
|
||||||
struct tm xtm,*local_tm,*utc_tm;
|
struct tm xtm,*utc_tm;
|
||||||
time_t localtim,utctime;
|
time_t localtim,utctime;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2309,7 +2322,6 @@ BOOL WINAPI SystemTimeToFileTime( const SYSTEMTIME *syst, LPFILETIME ft )
|
||||||
syst->wMilliseconds * 10000 );
|
syst->wMilliseconds * 10000 );
|
||||||
#else
|
#else
|
||||||
localtim = mktime(&xtm); /* now we've got local time */
|
localtim = mktime(&xtm); /* now we've got local time */
|
||||||
local_tm = localtime(&localtim);
|
|
||||||
utc_tm = gmtime(&localtim);
|
utc_tm = gmtime(&localtim);
|
||||||
utctime = mktime(utc_tm);
|
utctime = mktime(utc_tm);
|
||||||
DOSFS_UnixTimeToFileTime( 2*localtim -utctime, ft,
|
DOSFS_UnixTimeToFileTime( 2*localtim -utctime, ft,
|
||||||
|
|
|
@ -1326,6 +1326,7 @@ HANDLE WINAPI GetStdHandle(DWORD);
|
||||||
VOID WINAPI GetSystemInfo(LPSYSTEM_INFO);
|
VOID WINAPI GetSystemInfo(LPSYSTEM_INFO);
|
||||||
BOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS);
|
BOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS);
|
||||||
VOID WINAPI GetSystemTime(LPSYSTEMTIME);
|
VOID WINAPI GetSystemTime(LPSYSTEMTIME);
|
||||||
|
BOOL WINAPI GetSystemTimeAdjustment(PDWORD,PDWORD,PBOOL);
|
||||||
VOID WINAPI GetSystemTimeAsFileTime(LPFILETIME);
|
VOID WINAPI GetSystemTimeAsFileTime(LPFILETIME);
|
||||||
DWORD WINAPI GetTapeParameters(HANDLE,DWORD,LPDWORD,LPVOID);
|
DWORD WINAPI GetTapeParameters(HANDLE,DWORD,LPDWORD,LPVOID);
|
||||||
DWORD WINAPI GetTapePosition(HANDLE,DWORD,LPDWORD,LPDWORD,LPDWORD);
|
DWORD WINAPI GetTapePosition(HANDLE,DWORD,LPDWORD,LPDWORD,LPDWORD);
|
||||||
|
|
Loading…
Reference in New Issue