Quantcast
Viewing all articles
Browse latest Browse all 49206

using mktime correctly

In userpoints.module at line 1537 we have the following function

function userpoints_date_to_timestamp($date) {
  //This takes the FAPI date form array and returns a timestamp
  if ($date) {
    return mktime(0, 0, 0, $date['month'], $date['day'], $date['year']);
  }
}

The function works just fine and does exactly what its supposed to do BUT it throws an exception when run through simpletest. The following error is reported

mktime() [function.mktime]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead

I understand we can safely ignore this but I would rather not. We do have

variable_get('date_default_timezone', 0);

so we can get the site's default timezone and use this.

anyhow what's the proper way of getting rid of this error?


Viewing all articles
Browse latest Browse all 49206

Trending Articles