#pragma once

#include "DllDefines.h"

class UTILITYDLL CHighResPerformanceCounter
{
public:
    //  default constructor
    CHighResPerformanceCounter();

    //  default destructor
    virtual ~CHighResPerformanceCounter();

    //  record start count
    void StartCnt(void);

    //  record stop count
    void StopCnt(void);

    /// Gets current time span in msec.
    LONGLONG GetCurrentTimeSpanInMsec();
    double GetCurrentTimeSpanInSec();
    double GetCurrentTimeSpanInMin();
    double GetCurrentTimeSpanInHr();

    LONGLONG GetTimeSpanInMsec();
    double GetTimeSpanInSec();
    double GetTimeSpanInMin();
    double GetTimeSpanInHr();

    LONG GetTimeRemaining(LONG timeout);

    //  get current counter
    static LONGLONG GetCurrentCnt();

    //  cal msec time span in count
    static LONGLONG CalMsecTimeSpanInCnt(LONGLONG lMsec);

    //  cal time span in msec
    static LONGLONG CalTimeSpanInMsec(LONGLONG lcount);

    //  cal time span in sec
    static double CalTimeSpanInSec(LONGLONG lcount);

    //  cal time span in mins
    static double CalTimeSpanInMin(LONGLONG lCnt);

    //  cal time span in hours
    static double CalTimeSpanInHr(LONGLONG lCnt);

private:
    //  Start count
    LARGE_INTEGER m_lStartCnt;

    //  Stop count
    LARGE_INTEGER m_lStopCnt;
};