You are here

function _weather_es_next_act in Weather_es 6.2

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

Next data update. AEMET refresh the data at Spanish local time, about 07:00am

Using this code your server will look for the AEMET data once a day but I think its too much overhead to avoid getting the data from AEMET Web 6 times a day...

File

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

Code

function _weather_es_next_act() {
  $now = spanish_time();
  $hour = strftime('%H', $now);
  $dif = 7 - $hour;
  if ($dif >= 0) {
    $next_act_in = $dif;
  }
  else {
    $next_act_in = 24 - $hour + 7;
  }
  $ran = rand(0, 60) * 60;
  $next_act_in *= 3600;
  $next_act = $now + $next_act_in + $ran;
  return $next_act;
}