function retrieve_ts(url: string; xstart: string; xend: string):integer; external 'ytrf_retrieve_ts@maps\YaTraf.dll stdcall'; function GetIntParam(key: string): Integer; external 'ytrf_GetIntParam@maps\YaTraf.dll stdcall'; function SetIntParam(key: string; val: Integer): integer; external 'ytrf_SetIntParam@maps\YaTraf.dll stdcall'; function GetUTS: Longint; external 'ytrf_GetUTS@maps\YaTraf.dll stdcall'; function ts_update_needed(delta: integer):integer; var lts, ts : integer; lts_key: string; begin result:=0; lts_key:='ytrf_lts'; lts:=GetIntParam(lts_key); ts:=GetUTS; if (ts>lts+delta) then begin SetIntParam(lts_key, GetUTS); result:=1; end; end; function get_ts(delta: integer):integer; var ts_key, url, data: string; pt : LongInt; begin result:=0; ts_key:='ytrf_ts'; if (ts_update_needed(delta)>0) then begin url:='http://jgo.maps.yandex.net/trf/stat.js'; result:=retrieve_ts(url, 'timestamp:"', '"'); SetIntParam(ts_key, result); end else begin result:=GetIntParam(ts_key); end; end; begin ResultURL:=''; if (GetZ<>0) then ResultURL:=GetURLBase+inttostr(GetX)+'&y='+inttostr(GetY)+'&z='+inttostr(GetZ-1)+'&tm='+inttostr(get_ts(60)); end.