m...@netbsd.org (Emmanuel Dreyfus) writes: >This php function loops around gettimeofday() until the microsecond >changes: > do { > (void)gettimeofday((struct timeval *) &tv, (struct timezone *) NULL); > } while (tv.tv_sec == prev_tv.tv_sec && tv.tv_usec == prev_tv.tv_usec);
Yes, that's the difference between precision and resolution. While gettimeofday yields a value with a microsecond precision, the resolution depends on the timecounter, and some timecounters only provide a resolution of HZ ticks per second (usually 10ms). Polling for a change therefore can take 10000 times a microsecond and using a polling loop for uniquid is what I'd expect from php.