content:en_us:dev_framework_time_class_source_code

Time Class Source Code

To give you a feel for the code in the ClearOS API, here is a sampling of the Time class – the Time.GetTimeZoneList() method is shown below.

<code php> class Time extends Engine {

  ... snip ...
  
  /**
   * Returns a list of available time zones on the system.
   * 
   * @return array a list of available time zones
   * @throws EngineException
   */
  public function GetTimeZoneList()
  {
      if (COMMON_DEBUG_MODE)
          $this->Log(COMMON_DEBUG, "called", __METHOD__, __LINE__);
      $zonelist = array();
      $zoneinfo = array();
      foreach (explode(" ", self::PATH_ZONEINFO_SUBDIR) as $subzone) {
          try {
              $folder = new Folder(self::PATH_ZONEINFO . "/" . $subzone);
              $subzones = $folder->GetListing();
          } catch (Exception $e) {
              throw new EngineException($e->GetMessage(), COMMON_ERROR);
          }
          foreach ($subzones as $zone) {
              $md5 = md5_file(self::PATH_ZONEINFO . "/$subzone/$zone");
              $zoneinfo["fullzone"] = "$subzone/$zone";
              $zoneinfo["subzone"] = $subzone;
              $zoneinfo["zone"] = $zone;
              $zoneinfo["md5"] = $md5;
              $zonelist[] = $zoneinfo;
          }
      }
      return $zonelist;
  }
  ... snip ...

} search?q=clearos%2C%20clearos%20content%2C%20dev%2C%20framework%2C%20maintainer_dloper%2C%20maintainerreview_x%2C%20keywordfix&amp;btnI=lucky

content/en_us/dev_framework_time_class_source_code.txt · Last modified: 2014/12/23 22:10 by dloper

Page Tools