Fixed some alignment issues (based on a patch by Gregg Mattinson).

This commit is contained in:
Alexandre Julliard 2002-05-29 17:04:10 +00:00
parent 3629074d86
commit 94152d5038
2 changed files with 14 additions and 8 deletions

View File

@ -541,8 +541,10 @@ VOID WINAPI GetSystemTimeAsFileTime(
*/
static void TIME_ClockTimeToFileTime(clock_t unix_time, LPFILETIME filetime)
{
LONGLONG secs = RtlEnlargedUnsignedMultiply( unix_time, 10000000 );
((LARGE_INTEGER *)filetime)->QuadPart = RtlExtendedLargeIntegerDivide( secs, CLK_TCK, NULL );
ULONGLONG secs = RtlEnlargedUnsignedMultiply( unix_time, 10000000 );
secs = RtlExtendedLargeIntegerDivide( secs, CLK_TCK, NULL );
filetime->dwLowDateTime = (DWORD)secs;
filetime->dwHighDateTime = (DWORD)(secs >> 32);
}
/*********************************************************************

View File

@ -206,7 +206,8 @@ VOID WINAPI RtlSystemTimeToLocalTime(
*/
BOOLEAN WINAPI RtlTimeToSecondsSince1970( const FILETIME *time, LPDWORD res )
{
ULONGLONG tmp = RtlLargeIntegerDivide( ((LARGE_INTEGER *)time)->QuadPart, 10000000LL, NULL );
ULONGLONG tmp = ((ULONGLONG)time->dwHighDateTime << 32) | time->dwLowDateTime;
tmp = RtlLargeIntegerDivide( tmp, 10000000LL, NULL );
tmp -= SECS_1601_TO_1970;
if (tmp > 0xffffffff) return FALSE;
*res = (DWORD)tmp;
@ -218,7 +219,8 @@ BOOLEAN WINAPI RtlTimeToSecondsSince1970( const FILETIME *time, LPDWORD res )
*/
BOOLEAN WINAPI RtlTimeToSecondsSince1980( const FILETIME *time, LPDWORD res )
{
ULONGLONG tmp = RtlLargeIntegerDivide( ((LARGE_INTEGER *)time)->QuadPart, 10000000LL, NULL );
ULONGLONG tmp = ((ULONGLONG)time->dwHighDateTime << 32) | time->dwLowDateTime;
tmp = RtlLargeIntegerDivide( tmp, 10000000LL, NULL );
tmp -= SECS_1601_to_1980;
if (tmp > 0xffffffff) return FALSE;
*res = (DWORD)tmp;
@ -230,8 +232,9 @@ BOOLEAN WINAPI RtlTimeToSecondsSince1980( const FILETIME *time, LPDWORD res )
*/
void WINAPI RtlSecondsSince1970ToTime( DWORD time, FILETIME *res )
{
LONGLONG secs = time + SECS_1601_TO_1970;
((LARGE_INTEGER *)res)->QuadPart = RtlExtendedIntegerMultiply( secs, 10000000 );
ULONGLONG secs = RtlExtendedIntegerMultiply( time + SECS_1601_TO_1970, 10000000 );
res->dwLowDateTime = (DWORD)secs;
res->dwHighDateTime = (DWORD)(secs >> 32);
}
/******************************************************************************
@ -239,8 +242,9 @@ void WINAPI RtlSecondsSince1970ToTime( DWORD time, FILETIME *res )
*/
void WINAPI RtlSecondsSince1980ToTime( DWORD time, FILETIME *res )
{
LONGLONG secs = time + SECS_1601_to_1980;
((LARGE_INTEGER *)res)->QuadPart = RtlExtendedIntegerMultiply( secs, 10000000 );
ULONGLONG secs = RtlExtendedIntegerMultiply( time + SECS_1601_to_1980, 10000000 );
res->dwLowDateTime = (DWORD)secs;
res->dwHighDateTime = (DWORD)(secs >> 32);
}
/******************************************************************************