. */ $tick_cache_timeout = 60; function ryzom_time_tick() { $fn = RYAPI_URL.'data/cache/game_cycle.ticks'; $handle = fopen($fn, "r"); $version = fread($handle, 1); $raw_tick = fread($handle, 4); fclose($handle); $arr = unpack("V", $raw_tick); $tick = $arr[1]; return sprintf("%u", $tick & 0xffffffff); } /** * Takes a computed ryzom time array and returns a SimpleXMLElement */ function ryzom_time_xml($rytime) { global $tick_cache_timeout; $out = ryzom_time_xml_without_cache($rytime); $filename = RYAPI_URL.'data/cache/game_cycle.ticks'; $cache = $out->addChild('cache'); $cache->addAttribute('created', filemtime($filename)); $cache->addAttribute('expire', (filemtime($filename)+$tick_cache_timeout)); return $out; } ?>