Re: [PHP4] gettimeofday()
| From: | Rasmus Lerdorf | Date: | Mon, 07 Aug 2000 17:23:06 +0000 |
| Subject: | Re: [PHP4] gettimeofday() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-10507@lists.php.net to get a copy of this message | ||
Actually, looking at this further. micro is not 10^5 it is 10^6 so you
should be dividing by 10000000 there instead of 100000 which should clear
this up.
-Rasmus
> <?php
>
> function getCurrentTime () {
> $time_array = gettimeofday();
> return $time_array["sec"] + ($time_array["usec"]/100000);
> }
>
> $cache_time = 0;
> $cur_time = 0;
>
> echo "test starts...";
>
> for ($i=0; $i<10000; $i++) {
> $cur_time = getCurrentTime();
> echo "<br>time: $cur_time";
> if ($cur_time < $cache_time) { //if time starts going backwards
> echo " **********";
> }
> $cache_time = $cur_time;
> }
>
> ?>
>
>
> ----------------
> remco chang
> bountyquest.com
>
>
>