#ifndef GETTICKCOUNT_H
#define GETTICKCOUNT_H

#include <cstddef>		// Needed for NULL
#include <sys/time.h>		// Needed for gettimeofday
#include "types.h"		// Needed for uint32

inline uint32
GetTickCount(void)
{
  struct timeval aika;
  gettimeofday(&aika,NULL);
  unsigned long secs = aika.tv_sec * 1000;
  secs += (aika.tv_usec / 1000);
  return secs;
}

inline uint64 GetTickCount64()   // avoids 32bit rollover error for differences above 50days
{
  struct timeval aika;
  gettimeofday(&aika,NULL);
  return aika.tv_sec * 1000 + aika.tv_usec / 1000;
}

#endif // GETTICKCOUNT_H
