Back to index

nux  3.0.0
Public Member Functions
nux::GLTimer Class Reference

#include <GLTimer.h>

List of all members.

Public Member Functions

 GLTimer ()
 ~GLTimer ()
void Reset ()
float PassedMilliseconds ()

Detailed Description

Definition at line 29 of file GLTimer.h.


Constructor & Destructor Documentation

Definition at line 29 of file GLTimer.cpp.

  {
#if defined(NUX_OS_WINDOWS)
    LARGE_INTEGER freq;
    QueryPerformanceFrequency(&freq);
    QueryPerformanceCounter(&now);
    res = (float) (1.0f / (double) freq.QuadPart);
#elif defined(NUX_OS_LINUX)
    gettimeofday(&m_last_time, NULL);
#endif
  }

Definition at line 41 of file GLTimer.cpp.

  {
  }

Member Function Documentation

Definition at line 54 of file GLTimer.cpp.

  {
#if defined(NUX_OS_WINDOWS)
    LARGE_INTEGER temp;
    QueryPerformanceCounter(&temp);
    double elapsedTime = (temp.QuadPart - now.QuadPart) * res * 1000.0f;
    //now.QuadPart = temp.QuadPart;
    return elapsedTime;

#elif defined(NUX_OS_LINUX)
    timeval current_time;
    float elapsedTime;

    gettimeofday(&current_time, NULL);

    elapsedTime = (current_time.tv_sec - m_last_time.tv_sec) * 1000.0f;      // seconds to millisecond
    elapsedTime += (current_time.tv_usec - m_last_time.tv_usec) / 1000.0f;   // micro seconds to millisecond
    return elapsedTime;
#endif
  }

Here is the caller graph for this function:

void nux::GLTimer::Reset ( void  )

Definition at line 45 of file GLTimer.cpp.

  {
#if defined(NUX_OS_WINDOWS)
    QueryPerformanceCounter(&now);
#elif defined(NUX_OS_LINUX)
    gettimeofday(&m_last_time, NULL);
#endif
  }

Here is the caller graph for this function:


The documentation for this class was generated from the following files: