paulo@28: paulo@28: paulo@28: Weather paulo@28: paulo@28: paulo@28: paulo@28: paulo@28: paulo@28: 0) paulo@28: $cache_mtime = filemtime($cache_fn); paulo@28: paulo@28: $newbody = ''; paulo@28: paulo@28: if ((time() - $cache_mtime >= $cache_life)) { paulo@28: $newbody = shell_exec('./getweather.sh'); paulo@28: file_put_contents($cache_fn, $newbody); paulo@28: } else { paulo@28: $newbody = file_get_contents($cache_fn); paulo@28: } paulo@28: paulo@28: $end_time = microtime(true); paulo@28: $elapsed_time = $end_time - $start_time; paulo@28: paulo@28: echo "
";
paulo@28: echo $newbody;
paulo@28: echo "
"; paulo@28: paulo@28: echo "
Time elapsed: " . sprintf("%.3f", $elapsed_time) . " seconds.
"; paulo@28: ?> paulo@28: paulo@28: paulo@28: