
/*********************************************************************
*   < _TIMER.CPP >
**********************************************************************
*   タイマーの操作
*   RDTSC命令のタイマーができればなお良いが、
*   現在はマルチメディアタイマーを利用している
**********************************************************************
*                                                   Copyright (C) 2005
*   Programed by Ochi
*********************************************************************/

#include "_speed.h"

void CTimer::Start( void )
{
    /*LARGE_INTEGER tsc_tmp;

    __asm
    {
        rdtsc
        mov tsc_tmp.LowPart, eax
        mov tsc_tmp.HighPart, edx
    }

    tsc = tsc_tmp;*/

    KeepTime = timeGetTime();
}

unsigned long CTimer::Time( void )
{
    /*LARGE_INTEGER tsc_tmp;
    tsc_tmp = tsc;

    __asm
    {
        rdtsc
        sub eax, tsc_tmp.LowPart
        sbb edx, tsc_tmp.HighPart
        mov tsc_tmp.LowPart, eax
        mov tsc_tmp.HighPart, edx
    }
    
    char szTime[256];
    sprintf(szTime,"%I64d(ns):",tsc_tmp.QuadPart);
    char* pszTime = szTime;*/

    RealTime = timeGetTime();

    return (unsigned long)RealTime-(unsigned long)KeepTime;
}
