Exemplo n.º 1
0
BOOL WINAPI LocalFileTimeToFileTime( const FILETIME *localft, LPFILETIME utcft ) {
  LARGE_INTEGER local, utc;

  TRACEN((printf("LocalFileTimeToFileTime\n")))
  local.QuadPart = localft->dwHighDateTime;
  local.QuadPart = (local.QuadPart << 32) | localft->dwLowDateTime;
  RtlLocalTimeToSystemTime( &local, &utc );
  utcft->dwLowDateTime = (DWORD)utc.QuadPart;
  utcft->dwHighDateTime = (DWORD)(utc.QuadPart >> 32);

  return TRUE;
}
Exemplo n.º 2
0
/*********************************************************************
 *      LocalFileTimeToFileTime                         (KERNEL32.@)
 */
BOOL WINAPI LocalFileTimeToFileTime( const FILETIME *localft, LPFILETIME utcft )
{
    NTSTATUS status;
    LARGE_INTEGER local, utc;

    local.u.LowPart = localft->dwLowDateTime;
    local.u.HighPart = localft->dwHighDateTime;
    if (!(status = RtlLocalTimeToSystemTime( &local, &utc )))
    {
        utcft->dwLowDateTime = utc.u.LowPart;
        utcft->dwHighDateTime = utc.u.HighPart;
    }
    else SetLastError( RtlNtStatusToDosError(status) );

    return !status;
}
Exemplo n.º 3
0
/***********************************************************************
 *              SetLocalTime            (KERNEL32.@)
 *
 *  Set the local time using current time zone and daylight
 *  savings settings.
 *
 * PARAMS
 *  systime [in] The desired local time.
 *
 * RETURNS
 *  Success: TRUE. The time was set.
 *  Failure: FALSE, if the time was invalid or caller does not have
 *           permission to change the time.
 */
BOOL WINAPI SetLocalTime( const SYSTEMTIME *systime )
{
    FILETIME ft;
    LARGE_INTEGER st, st2;
    NTSTATUS status;

    if( !SystemTimeToFileTime( systime, &ft ))
        return FALSE;
    st.u.LowPart = ft.dwLowDateTime;
    st.u.HighPart = ft.dwHighDateTime;
    RtlLocalTimeToSystemTime( &st, &st2 );

    if ((status = NtSetSystemTime(&st2, NULL)))
        SetLastError( RtlNtStatusToDosError(status) );
    return !status;
}