function xarMLS_userOffset($timestamp = null) { static $offset; // minimal information for timezone offset handling static $timezone; // more information for daylight saving if (!isset($offset)) { // CHECKME: use dynamicdata for roles, module user variable and/or session variable // (see also 'locale' in xarUserGetNavigationLocale()) // get the correct timezone offset for this user if (xarUserIsLoggedIn()) { $offset = xarUserGetVar('timezone'); // get the actual timezone for the user (in addition to the timezone offset) if (isset($offset) && !is_numeric($offset)) { $info = @unserialize($offset); if (!empty($info) && is_array($info)) { $offset = isset($info['offset']) ? $info['offset'] : null; $timezone = isset($info['timezone']) ? $info['timezone'] : null; } } } //Anon User non logged in. if (!$offset) { // use default time offset for this site $offset = $GLOBALS['xarMLS_defaultTimeOffset']; // use default timezone for this site $timezone = $GLOBALS['xarMLS_defaultTimeZone']; } } // this will depend on the current $timestamp if (isset($timestamp) && !empty($timezone) && function_exists('xarModAPIFunc')) { $adjust = xarModAPIFunc('base','user','dstadjust', array('timezone' => $timezone, // pass the timestamp *with* the offset 'time' => $timestamp + $offset * 3600)); } else { $adjust = 0; } return $offset + $adjust; }