You are here

function spanish_time in Weather_es 6

Same name and namespace in other branches
  1. 5 weather_es_parser.inc \spanish_time()
  2. 6.2 weather_es_parser.inc \spanish_time()

Return the Spanish (peninsula) time

1 call to spanish_time()
_weather_es_next_act in ./weather_es_parser.inc
Next data update. AEMET refresh the data at Spanish local time, about 07:00am

File

./weather_es_parser.inc, line 421
Gets the data from the AEMET web

Code

function spanish_time() {

  // get the server time and change it to Spanish time
  if (function_exists('date_default_timezone_get')) {
    $server_time = date_default_timezone_get();
    date_default_timezone_set('Europe/Madrid');
  }
  else {
    $server_time = ini_get('date.timezone');
    ini_set('date.timezone', 'Europe/Madrid');
  }
  $now = time();

  // save the original server timezone
  if (function_exists('date_default_timezone_set')) {
    date_default_timezone_set('$server_time');
  }
  else {
    ini_set('date.timezone', '$server_time');
  }
  return $now;
}