A Portable Implementation of GetTickCount

// Return current time in millisecs with 24 hours reset
inline unsigned int utilGetTickCount ()
{
#ifdef WIN32
  return GetTickCount();
#else
  struct timeval t;
  gettimeofday ( &t, NULL );
  t.tv_sec %= 8640; // one day ticks 24*60*60
  return ( t.tv_sec*1000 + t.tv_usec/1000 );
#endif
}