コード例 #1
0
ファイル: Viewport3D.cpp プロジェクト: HoverRace/HoverRace
void Viewport3D::ApplyRotationMatrix(const MR_2DCoordinate & pSrc, MR_2DCoordinate & pDest) const
{
	MR_3DCoordinate lPos;

	lPos.mX = pSrc.mX - mPosition.mX;
	lPos.mY = pSrc.mY - mPosition.mY;

	pDest.mX = (MR_Int32) Int64ShraMod32(Int32x32To64(lPos.mX, mRotationMatrix[0][0]) + Int32x32To64(lPos.mY, mRotationMatrix[0][1]), MR_TRIGO_SHIFT);
	pDest.mY = (MR_Int32) Int64ShraMod32(Int32x32To64(lPos.mX, mRotationMatrix[1][0]) + Int32x32To64(lPos.mY, mRotationMatrix[1][1]), MR_TRIGO_SHIFT);
}
コード例 #2
0
ファイル: Viewport3D.cpp プロジェクト: HoverRace/HoverRace
void Viewport3D::ApplyPositionMatrix(const PositionMatrix & pMatrix, const MR_3DCoordinate & pSrc, MR_3DCoordinate & pDest) const
{
	MR_2DCoordinate lPos;

	lPos.mX = (MR_Int32) Int64ShraMod32(Int32x32To64(pSrc.mX, pMatrix.mRotation[0][0]) + Int32x32To64(pSrc.mY, pMatrix.mRotation[0][1]), MR_TRIGO_SHIFT) + pMatrix.mDisplacement.mX;
	lPos.mY = (MR_Int32) Int64ShraMod32(Int32x32To64(pSrc.mX, pMatrix.mRotation[1][0]) + Int32x32To64(pSrc.mY, pMatrix.mRotation[1][1]), MR_TRIGO_SHIFT) + pMatrix.mDisplacement.mY;

	ApplyRotationMatrix(lPos, pDest);

	pDest.mZ = pSrc.mZ + pMatrix.mDisplacement.mZ - mPosition.mZ;

}
コード例 #3
0
ファイル: j4prof.c プロジェクト: BillTheBest/WinNT4
ULONG
HalSetProfileInterval (
    IN ULONG Interval
    )

/*++

Routine Description:

    This routine sets the profile interrupt interval.

Arguments:

    Interval - Supplies the desired profile interval in 100ns units.

Return Value:

    The actual profile interval.

--*/

{

    LARGE_INTEGER TempValue;

    //
    // If the specified profile interval is less that the minimum profile
    // interval or greater than the maximum profile interval, then set the
    // profile interval to the minimum or maximum as appropriate.
    //

    if (Interval < MINIMUM_PROFILE_INTERVAL) {
        Interval = MINIMUM_PROFILE_INTERVAL;

    } else if (Interval > MAXIMUM_PROFILE_INTERVAL) {
        Interval = MAXIMUM_PROFILE_INTERVAL;
    }

    //
    // First compute the profile count value and then back calculate the
    // actual profile interval.
    //

    TempValue.QuadPart = Int32x32To64(HalpProfileCountRate, Interval);
    TempValue.QuadPart += ROUND_VALUE;
    TempValue = RtlExtendedLargeIntegerDivide(TempValue, ONE_SECOND, NULL);
    TempValue.QuadPart = Int32x32To64(TempValue.LowPart, ONE_SECOND);
    TempValue = RtlExtendedLargeIntegerDivide(TempValue, HalpProfileCountRate, NULL);
    HalpProfileInterval = TempValue.LowPart;
    return HalpProfileInterval;
}
コード例 #4
0
ファイル: filefind.c プロジェクト: Malaar/luaplus51-all
static int filefind_index_write_FILETIME_helper(lua_State* L, struct FileFindInfo* info) {
#if defined(WIN32)
	return _filefind_push_FILETIME(L, &info->fd.ftLastWriteTime);
#else
	return _filefind_push_FILETIME(L, Int32x32To64(info->attr.st_mtime, 10000000) + 116444736000000000);
#endif
}
コード例 #5
0
ファイル: vfs.cpp プロジェクト: KonstantinKuklin/WalCommander
static void TT_to_FILETIME( time_t t, FILETIME& ft )
{
	LONGLONG ll;
	ll = Int32x32To64( t, 10000000 ) + 116444736000000000ll;
	ft.dwLowDateTime = ( DWORD )ll;
	ft.dwHighDateTime = ll >> 32;
}
コード例 #6
0
ファイル: c_time.c プロジェクト: msphn/client
//after Microsoft KB167296
static void UnixTimevalToFileTime(struct timeval t, LPFILETIME pft)
{
    LONGLONG ll;
    ll = Int32x32To64(t.tv_sec, CSYNC_USEC_IN_SEC*10) + t.tv_usec*10 + CSYNC_SECONDS_SINCE_1601*CSYNC_USEC_IN_SEC*10;
    pft->dwLowDateTime = (DWORD)ll;
    pft->dwHighDateTime = ll >> 32;
}
コード例 #7
0
ファイル: ULTI_File.cpp プロジェクト: wizebin/ulti
void UnixTimeToFileTime(time_t t, LPFILETIME pft){
    LONGLONG ll;

    ll = Int32x32To64(t, 10000000) + 116444736000000000;
    pft->dwLowDateTime = (DWORD)ll;
    pft->dwHighDateTime = ll >> 32;
}
コード例 #8
0
ファイル: logviewer.c プロジェクト: Tinkerforge/brickd
static void format_timestamp(uint64_t seconds, int microseconds,
                             char *buffer, int length, char *date_separator,
                             char *date_time_separator, char *time_separator) {
	ULONGLONG timestamp = 0;
	ULONGLONG offset_to_1970 = 116444736000000000;
	SYSTEMTIME st;
	FILETIME ft, ft_local;

	timestamp = Int32x32To64(seconds, 10000000) + offset_to_1970;
	ft.dwHighDateTime = (DWORD)((timestamp >> 32) & 0xFFFFFFFF);
	ft.dwLowDateTime = (DWORD)(timestamp & 0xFFFFFFFF);

	FileTimeToLocalFileTime(&ft, &ft_local);
	FileTimeToSystemTime(&ft_local, &st);

	if (microseconds < 0) {
		_snprintf(buffer, length, "%d%s%02d%s%02d%s%02d%s%02d%s%02d",
		          st.wYear, date_separator, st.wMonth, date_separator,
		          st.wDay, date_time_separator, st.wHour, time_separator,
		          st.wMinute, time_separator, st.wSecond);
	} else {
		_snprintf(buffer, length, "%d%s%02d%s%02d%s%02d%s%02d%s%02d.%06d",
		          st.wYear, date_separator, st.wMonth, date_separator,
		          st.wDay, date_time_separator, st.wHour, time_separator,
		          st.wMinute, time_separator, st.wSecond, microseconds);
	}
}
コード例 #9
0
ファイル: ArchiverUNARJ.cpp プロジェクト: Claybird/lhaforge
bool CArchiverUNARJ::InspectArchiveGetWriteTime(FILETIME &FileTime)
{
	if(!m_hInspectArchive){
		ASSERT(!"Open an Archive First!!!\n");
		return false;
	}
	//拡張版関数で時刻取得
	if(ArchiverGetWriteTimeEx){
		FILETIME TempTime;
		if(!ArchiverGetWriteTimeEx(m_hInspectArchive,&TempTime))return false;
		if(!LocalFileTimeToFileTime(&TempTime,&FileTime))return false;
		return true;
	}
	//通常版関数で時刻取得
	else if(ArchiverGetWriteTime){
		DWORD UnixTime=ArchiverGetWriteTime(m_hInspectArchive);
		if(-1==UnixTime){
			return false;
		}
		//time_tからFileTimeへ変換
		LONGLONG ll = Int32x32To64(UnixTime, 10000000) + 116444736000000000;
		FileTime.dwLowDateTime = (DWORD) ll;
		FileTime.dwHighDateTime = (DWORD)(ll >>32);
		return true;
	}
	else{
コード例 #10
0
/* This starts the timer */ 
NFCSTATUS phOsalNfc_Timer_Start(uint32_t    TimerId,
                          uint32_t     dueTimeMsec, 
                          ppCallBck_t  pCallback,
                          void         *pContext)
{
    uint32_t  uIndex;
    LONGLONG  DueTime;
    uint32_t  uWindow = (dueTimeMsec < 50) ? 0 : (dueTimeMsec / 4);

    if (NULL == gpphOsalNfc_Context ||
        PH_OSALNFC_TIMER_ID_INVALID == TimerId) {
        return PHNFCSTVAL(CID_NFC_OSAL, NFCSTATUS_INVALID_PARAMETER);
    }

    uIndex = TimerId - PH_OSAL_TIMER_BASE_ADDRESS;
    
    // Convert dueTimeMsec to relative filetime units (100ns)
    DueTime = Int32x32To64(dueTimeMsec, -10000);

    EnterCriticalSection(&gpphOsalNfc_Context->TimerLock);

    SetThreadpoolTimer(gpphOsalNfc_Context->TimerList[uIndex].pTimer, (FILETIME*)&DueTime, 0, uWindow);
    gpphOsalNfc_Context->TimerList[uIndex].pCallback = pCallback;
    gpphOsalNfc_Context->TimerList[uIndex].pContext  = pContext;

    LeaveCriticalSection(&gpphOsalNfc_Context->TimerLock);

    return NFCSTATUS_SUCCESS;
}
コード例 #11
0
ファイル: FileSystem.cpp プロジェクト: N0U/pr-downloader
void CFileSystem::TimestampToFiletime(const time_t t, _FILETIME& pft)
{
	LONGLONG ll;
	ll = Int32x32To64(t, 10000000) + 116444736000000000;
	pft.dwLowDateTime = (DWORD)ll;
	pft.dwHighDateTime = ll >> 32;
}
コード例 #12
0
ファイル: sys_arch.c プロジェクト: GYGit/reactos
u32_t
sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout)
{
    LARGE_INTEGER LargeTimeout, PreWaitTime, PostWaitTime;
    UINT64 TimeDiff;
    NTSTATUS Status;
    PVOID Message;
    PLWIP_MESSAGE_CONTAINER Container;
    PLIST_ENTRY Entry;
    KIRQL OldIrql;
    PVOID WaitObjects[] = {&mbox->Event, &TerminationEvent};
    
    LargeTimeout.QuadPart = Int32x32To64(timeout, -10000);
    
    KeQuerySystemTime(&PreWaitTime);

    Status = KeWaitForMultipleObjects(2,
                                      WaitObjects,
                                      WaitAny,
                                      Executive,
                                      KernelMode,
                                      FALSE,
                                      timeout != 0 ? &LargeTimeout : NULL,
                                      NULL);

    if (Status == STATUS_WAIT_0)
    {
        KeAcquireSpinLock(&mbox->Lock, &OldIrql);
        Entry = RemoveHeadList(&mbox->ListHead);
        ASSERT(Entry);
        if (IsListEmpty(&mbox->ListHead))
            KeClearEvent(&mbox->Event);
        KeReleaseSpinLock(&mbox->Lock, OldIrql);
        
        Container = CONTAINING_RECORD(Entry, LWIP_MESSAGE_CONTAINER, ListEntry);
        Message = Container->Message;
        ExFreePool(Container);
        
        if (msg)
            *msg = Message;

        KeQuerySystemTime(&PostWaitTime);
        TimeDiff = PostWaitTime.QuadPart - PreWaitTime.QuadPart;
        TimeDiff /= 10000;
        
        return TimeDiff;
    }
    else if (Status == STATUS_WAIT_1)
    {
        /* DON'T remove ourselves from the thread list! */
        PsTerminateSystemThread(STATUS_SUCCESS);
        
        /* We should never get here! */
        ASSERT(FALSE);
        
        return 0;
    }
    
    return SYS_ARCH_TIMEOUT;
}
コード例 #13
0
bool UnixTimeToFileTime(unsigned long mtime, LPFILETIME ft)
{
	// Note that LONGLONG is a 64-bit value
	LONGLONG ll = Int32x32To64(mtime, 10000000) + 116444736000000000;
	ft->dwLowDateTime = (DWORD)ll;
	ft->dwHighDateTime = ll >> 32;
	return true;
}
コード例 #14
0
ファイル: TimeUtil.cpp プロジェクト: HTshandou/TouchMind
void touchmind::util::TimeUtil::UnixTimeToFileTime(time_t t, FILETIME* fileTime)
{
    LONGLONG ll;

    ll = Int32x32To64(t, 10000000) + 116444736000000000;
    fileTime->dwLowDateTime = (DWORD) ll;
    fileTime->dwHighDateTime = ll >> 32;
}
コード例 #15
0
ファイル: stdafx.cpp プロジェクト: VictorVG/4
FILETIME UnixTimeToFileTime(const time_t t)
{
    FILETIME ft;
    const LONGLONG ll = Int32x32To64(t, 10000000) + 116444736000000000;
    ft.dwLowDateTime = static_cast<DWORD>(ll);
    ft.dwHighDateTime = ll >> 32;
    return ft;
}
コード例 #16
0
void UnixTimeToFileTime(const time_t t, LPFILETIME pft)
{
    // Note that LONGLONG is a 64-bit value
    LONGLONG ll;
    ll = Int32x32To64(t, SECS_TO_100NS) + SECS_BETWEEN_EPOCHS * SECS_TO_100NS;
    pft->dwLowDateTime = (DWORD)ll;
    pft->dwHighDateTime = ll >> 32;
}
AREXPORT bool ArUtil::changeFileTimestamp(const char *fileName, 
                                          time_t timestamp) 
{
  if (ArUtil::isStrEmpty(fileName)) {
    ArLog::log(ArLog::Normal,
               "Cannot change date on file with empty name");
    return false;
  }
#ifdef WIN32

  FILETIME fileTime;

  HANDLE hFile = CreateFile(fileName,
                            GENERIC_READ | GENERIC_WRITE,
                             0,NULL,
                             OPEN_EXISTING,
                             0,NULL);

  if (hFile == NULL) {
    return false;
  }


  // The following is extracted from the MSDN article "Converting a time_t Value
  // to a File Time".
  LONGLONG temp = Int32x32To64(timestamp, 10000000) + 116444736000000000;
  fileTime.dwLowDateTime = (DWORD) temp;
  fileTime.dwHighDateTime = temp >> 32;

  SetFileTime(hFile, 
              &fileTime, 
              (LPFILETIME) NULL,  // don't change last access time (?)
              &fileTime);

  CloseHandle(hFile);

#else // unix
        
  char timeBuf[500];
  strftime(timeBuf, sizeof(timeBuf), "%c", ::localtime(&timestamp));
  ArLog::log(ArLog::Normal,
             "Changing file %s modified time to %s",
             fileName,
             timeBuf);


  // time_t newTime = mktime(&timestamp);
  struct utimbuf fileTime;
  fileTime.actime  = timestamp;
  fileTime.modtime = timestamp;
  utime(fileName, &fileTime);

#endif // else unix

  return true;

} // end method changeFileTimestamp
コード例 #18
0
ファイル: TypeViewGui.cpp プロジェクト: 4aiman/HexEdit
void UnixTimeToFileTime(time_t t, LPFILETIME pft)
{
	// Note that LONGLONG is a 64-bit value
	LONGLONG ll;
	
	ll = Int32x32To64(t, 10000000) + 116444736000000000;
	pft->dwLowDateTime  = (DWORD)ll;
	pft->dwHighDateTime = (DWORD)(ll >> 32);
}
コード例 #19
0
ファイル: tsrm_win32.c プロジェクト: Distrotech/php-src
static zend_always_inline void UnixTimeToFileTime(time_t t, LPFILETIME pft) /* {{{ */
{
	// Note that LONGLONG is a 64-bit value
	LONGLONG ll;

	ll = Int32x32To64(t, 10000000) + 116444736000000000;
	pft->dwLowDateTime = (DWORD)ll;
	pft->dwHighDateTime = ll >> 32;
}
コード例 #20
0
ファイル: j4prof.c プロジェクト: BillTheBest/WinNT4
VOID
HalStartProfileInterrupt (
    KPROFILE_SOURCE ProfileSource
    )

/*++

Routine Description:

    This routine computes the profile count value, writes the compare
    register, clears the count register, and updates the performance
    counter.

    N.B. This routine must be called at PROFILE_LEVEL while holding the
        profile lock.

Arguments:

    Source - Supplies the profile source.

Return Value:

    None.

--*/

{

    PKPRCB Prcb;
    ULONG PreviousCount;
    LARGE_INTEGER TempValue;

    //
    // Compute the profile count from the current profile interval.
    //

    TempValue.QuadPart = Int32x32To64(HalpProfileCountRate,
                                      HalpProfileInterval);

    TempValue.QuadPart += ROUND_VALUE;
    TempValue = RtlExtendedLargeIntegerDivide(TempValue, ONE_SECOND, NULL);

    //
    // Write the compare register and clear the count register.
    //

    PreviousCount = HalpWriteCompareRegisterAndClear(TempValue.LowPart);

    //
    // Update the performance counter by adding in the previous count value.
    //

    Prcb = KeGetCurrentPrcb();
    HalpPerformanceCounter[Prcb->Number].QuadPart += PreviousCount;
    return;
}
コード例 #21
0
ファイル: utils.cpp プロジェクト: x1596357/dokany
FILETIME unixTimeToFiletime(time_t t) {
  // Note that LONGLONG is a 64-bit value
  LONGLONG ll;

  ll = Int32x32To64(t, 10000000) + 116444736000000000LL;
  FILETIME res;
  res.dwLowDateTime = (DWORD)ll;
  res.dwHighDateTime = (DWORD)(ll >> 32);
  return res;
}
コード例 #22
0
ファイル: xmlrpc_datetime.c プロジェクト: arssivka/naomech
void
UnixTimeToFileTime(time_t     const t,
                   LPFILETIME const pft) {

    int64_t const ll =
        Int32x32To64(t, SECS_TO_100NS) + SECS_BETWEEN_EPOCHS * SECS_TO_100NS;

    pft->dwLowDateTime  = (DWORD)ll;
    pft->dwHighDateTime = (DWORD)(ll >> 32);
}
コード例 #23
0
/**
 * Convert Unix time_t to FILETIME
 */
void Time_tToFileTime(time_t t, FILETIME &ft) {

     // Note that LONGLONG is a 64-bit value. From MS article 
     // http://support.microsoft.com/default.aspx?scid=KB;en-us;q167296
     LONGLONG ll;
     ll = Int32x32To64(t, 10000000) + 116444736000000000;
     ft.dwLowDateTime =  (DWORD)ll;
     ft.dwHighDateTime = (DWORD)(ll >> 32);    
     
}
コード例 #24
0
ファイル: dokan_tools.c プロジェクト: snua12/zlomekfs
/*! \brief converts unix time to windows time
 *
 *  based on microsoft kb 167296
 * \param ftime pointer to place where is windows time stored
 * \param ztime unix time representation
 */
static void zfstime_to_filetime(PFILETIME ftime, zfs_time ztime)
{
	if (ftime == NULL || ztime == ((zfs_time) - 1)) return;
	// based on microsoft kb 167296
	LONGLONG ll;
	ll = Int32x32To64(ztime, 10000000) + 116444736000000000;

	ftime->dwLowDateTime = (DWORD) ll;
	ftime->dwHighDateTime = ll >> 32;
}
コード例 #25
0
ファイル: Detours.cpp プロジェクト: AdamKotynia/bwapi
//--------------------------------------- GetSystemTimeAsFileTime --------------------------------------------
void WINAPI _GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime)
{
  auto replacementSeed = BWAPI::BroodwarImpl.seedOverride;
  if (lpSystemTimeAsFileTime != nullptr && replacementSeed != std::numeric_limits<decltype(replacementSeed)>::max())
  {
    // https://support.microsoft.com/kb/167296
    auto ll = Int32x32To64(replacementSeed, 10000000) + 116444736000000000;
    lpSystemTimeAsFileTime->dwLowDateTime = (DWORD)ll;
    lpSystemTimeAsFileTime->dwHighDateTime = ll >> 32;
    return;
  }
コード例 #26
0
ファイル: Platform.Win32.cpp プロジェクト: OpenRCT2/OpenRCT2
    static SYSTEMTIME TimeToSystemTime(std::time_t timestamp)
    {
        LONGLONG ll = Int32x32To64(timestamp, 10000000) + 116444736000000000;

        FILETIME ft;
        ft.dwLowDateTime = (DWORD)ll;
        ft.dwHighDateTime = ll >> 32;

        SYSTEMTIME st;
        FileTimeToSystemTime(&ft, &st);
        return st;
    }
コード例 #27
0
ファイル: time.win.cpp プロジェクト: jnterry/xeno-engine
	DateTime fromCTime(time_t t){
		// adapted from: https://docs.microsoft.com/en-us/windows/desktop/sysinfo/converting-a-time-t-value-to-a-file-time
		DateTime dt;

		FILETIME* ftime = (FILETIME*)&dt._data;

	  LONGLONG t_val = Int32x32To64(t, 10000000) + 116444736000000000;
    ftime->dwLowDateTime = (DWORD) t_val;
    ftime->dwHighDateTime = t_val >>32;

    return dt;
	}
コード例 #28
0
ファイル: filefind.c プロジェクト: Malaar/luaplus51-all
static int l_filefind_FILETIME_to_unix_time_UTC(lua_State* L) {
	time_t unixTime = (time_t)luaL_checknumber(L, 1);
#if _MSC_VER
		__int64 ll; // 64 bit value
#else
		signed long long ll;
#endif
	ll = Int32x32To64(unixTime, 10000000) + 116444736000000000ui64;
	lua_pushnumber(L, (DWORD)ll);
	lua_pushnumber(L, (DWORD)(ll >> 32));
	return 2;
}
コード例 #29
0
ファイル: helpers.cpp プロジェクト: Reynmar/pocketheroes
iStringT FormatDate(uint32 timestamp, bool bShowTime)
{
	FILETIME ft;
	SYSTEMTIME st;
	LONGLONG ll;
	ll = Int32x32To64(timestamp, 600000000);
	ft.dwLowDateTime = (DWORD)ll;
	ft.dwHighDateTime = ll >> 32;
	FileTimeToSystemTime(&ft, &st);
	if (bShowTime) return iFormat(_T("%d %s %d (%d:%02d)"), st.wDay, gTextMgr[TRID_MONTH_JAN+st.wMonth-1], st.wYear, st.wHour, st.wMinute);
	else return iFormat(_T("%d %s %d"), st.wDay, gTextMgr[TRID_MONTH_JAN+st.wMonth-1], st.wYear);
}
コード例 #30
0
ファイル: iso.c プロジェクト: ShaRose/rufus
// Convert from time_t to FILETIME
// Uses 3 static entries so that we can convert 3 concurrent values at the same time
static LPFILETIME __inline to_filetime(time_t t)
{
	static int i = 0;
	static FILETIME ft[3], *r;
	LONGLONG ll = Int32x32To64(t, 10000000) + 116444736000000000;

	r = &ft[i];
	r->dwLowDateTime = (DWORD)ll;
	r->dwHighDateTime = (DWORD)(ll >> 32);
	i = (i + 1) % ARRAYSIZE(ft);
	return r;
}