Re: GTimers - do they need initialization ?



Read the documentation for g_timer_elapsed() more closely.

#include <stdio.h>
#include <glib/gtimer.h>

int main (int argc, char* argv[])
{
  double seconds;
  gulong microseconds;

  GTimer* pTimer = g_timer_new ();

  do {
    seconds = g_timer_elapsed (pTimer, &microseconds);
    printf ("Time elapsed = %d.%06lu\n", (int) seconds, microseconds);
    g_usleep (1000000);
  } while (seconds < 10);

  return 0;
}

--tml


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]