Difference between revisions of "Ryzom API/Time"

From EncyclopAtys

Jump to: navigation, search
(URL Parameters)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 +
<noinclude>{{Trad|DE=Ryzom API/Time|FR=Ryzom API/Time|palette=atys|H=1}}</noinclude>
 
To know the time and date in Ryzom.
 
To know the time and date in Ryzom.
 
===Usage===
 
===Usage===
Line 44: Line 45:
 
   } else {
 
   } else {
 
     echo "API failure";
 
     echo "API failure";
   }</syntaxhighlight>
+
   }
 +
?></syntaxhighlight>
  
 
<noinclude>[[Category:Ryzom API|Time]]</noinclude>
 
<noinclude>[[Category:Ryzom API|Time]]</noinclude>

Latest revision as of 05:29, 15 March 2023

de:Ryzom API/Time fr:Ryzom API/Time
 
UnderConstruction.png
Translation to review
Don't blame the contributors, but come and help them 😎

Reference text ( Maintained text, used as reference ) :
Notes: (Leda, 2023-03-15)

To know the time and date in Ryzom.

Usage

<base URL>/time.php

URL Parameters

format
(optional), defaults ro raw.
  • raw : Returns the tick. The server tick is a 32 bit integer that increases by one every 100 milliseconds.
  • txt : Returns a homine-readable string.
  • xml : Returns an xml file that contains all shard time information.

Cache duration

The data is cached for 1 minute.

XML structure

<shard_time>
  <server_tick>514105152</server_tick>
  <jena_year>2576</jena_year>
  <day_of_jy>319</day_of_jy>
  <month_of_jy>10</month_of_jy>
  <cycle>0</cycle>
  <day_of_cycle>319</day_of_cycle>
  <month_of_cycle>10</month_of_cycle>
  <day_of_month>19</day_of_month>
  <day_of_week>1</day_of_week>
  <season>3</season>
  <day_of_season>49</day_of_season>
  <time_of_day>13</time_of_day>
  <txt_en>13h - Dua, Mystia 20, 1st AC 2576</txt_en>
  <txt_fr>13h - Dua, Mystia 20, 1er CA 2576</txt_fr>
  <txt_de>13h - Dua, Mystia 20, 1. AZ 2576</txt_de>
  <cache created="1387437183" expire="1387437243"/>
</shard_time>

PHP interface

ryzom_time_api() : Returns SimpleXMLElement or boolean false on failure.
<?php
  require_once "ryzomapi_lite.php";

  $time = ryzom_time_api('xml');
  if ($time !== false) {
    $txt_en = htmlspecialchars($time->txt_en);
    echo "Atys time is {$txt_en}";
  } else {
    echo "API failure";
  }
?>