Time_.h#

Class for dealing with time in a cross-platform way.

Includes#

  • cstdint

Included By#

Namespaces#

Classes#

Defines#

Source Code#

#pragma once
#include <cstdint>
// Required forward declarations
#if defined(__APPLE__)
struct mach_timebase_info;
#endif
#if !defined(__APPLE__)
#define PVR_PLATFORM_USES_TIMESTAMP
#endif
namespace pvr {
class Time
{
public:
    Time();
    ~Time();
#if defined(PVR_PLATFORM_USES_TIMESTAMP)
    void Reset();
#endif
    uint64_t getElapsedNanoSecs() const;
    uint64_t getElapsedMicroSecs() const;
    float getElapsedMicroSecsF() const;
    uint64_t getElapsedMilliSecs() const;
    float getElapsedMilliSecsF() const;
    uint64_t getElapsedSecs() const;
    float getElapsedSecsF() const;
    uint64_t getElapsedMins() const;
    float getElapsedMinsF() const;
    uint64_t getElapsedHours() const;
    float getElapsedHoursF() const;

private:
#if defined(PVR_PLATFORM_USES_TIMESTAMP)
    uint64_t getCurrentTimeStamp() const;

    uint64_t getTimerFrequencyHertz() const;
    uint64_t _startTime;
    uint64_t _timerFrequency;
#endif

#if defined(__APPLE__)
    struct mach_timebase_info* _timeBaseInfo;
#endif
};
} // namespace pvr