>>> and using a polling loop for uniquid is what I'd expect from php. >> Whether or not it's good, bad, or just ugly, it looks to me as >> though it's exposed a bug. > Is it documented that gettimeofday has any particular resolution, or > that successive values are unique?
Not a bug in the sense that gettimeofday is violating its interface contract, just a bug in the sense that "something is wrong". I'd say gettimeofday() taking as long as a second, measured by ktrace records, indicates a bug; everything involved is entirely in-kernel, so that can't really be blamed on userland. > I don't think it is, and I remember it being normal to have it > increase by 10 ms at a time, back when it was really cool to have a > microVAX III instead of a II. Yes. VAX timekeeping is rather bad by modern standards; many VAXen (the KA630, used by the MicroVAX-II, in particular - I don't know the MicroVAX-III in this regard) are not capable of better than 10ms. There's no cycle counter and the ICCS can't do anything but an interrupt every 10ms - NICR and ICR are subsetted away. Ping from my (emulated) MicroVAX prints RTTs with approximately 10ms of granaularity; I'm not sure why they're not all exactly 10ms granularity, but I suspect it's the "increment the usec" behaviour. Looking at the code, 1.4T's vax microtime() does an MFPR from the ICR on everything but VAX46 (the VS 4k/60). I don't see any statement in the VARM that ICR must be implemented at all if interval timing is subsetted out; presumably 1.4T depends on all processors it supports, except VAX46, either fully implementing ICR or implementing it as read-as-zero. And, yes, here's that "increment the usec" behaviour: if (tvp->tv_sec == lasttime.tv_sec && tvp->tv_usec <= lasttime.tv_usec && (tvp->tv_usec = lasttime.tv_usec + 1) >= 1000000) { tvp->tv_sec++; tvp->tv_usec -= 1000000; } bcopy(tvp, &lasttime, sizeof(struct timeval)); Obviously, this depends on the system not sustaining as many as a million fetches of the time (gettimeofday() being only one of variousp things which can call microtime()) per second for any significant period. /~\ The ASCII Mouse \ / Ribbon Campaign X Against HTML mo...@rodents-montreal.org / \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B