note 30761 added to function.gettimeofday

From: Date: Thu, 27 Mar 2003 16:48:28 +0000
Subject: note 30761 added to function.gettimeofday
Groups: php.notes 
Request: Send a blank email to php-notes+get-45914@lists.php.net to get a copy of this message
The solution above has a bug due to cycling 'usec' in range of 0 to 999999 with period of one second. True timing could be as something: function get_timer() { $t=gettimeofday(); return (double)($t['sec'].'.'.$t['usec']); } $wakeup=get_timer()+$delay; while(get_timer()<$wakeup); 'sec' is UNIX seconds from 1/1/1970 (absolute time) and such way is no matter of cycling millimicroseconds between seconds (change of $t['usec'] from '999999' to '0' with one $t['sec'] increment) and seconds themselves between days (change of 23:59:59 to 0:00:00) jz -- http://www.php.net/manual/en/function.gettimeofday.php http://master.php.net/manage/user-notes.php?action=edit+30761 http://master.php.net/manage/user-notes.php?action=delete+30761 http://master.php.net/manage/user-notes.php?action=reject+30761

« previous php.notes (#45914) next »