public static function getTimezone()
    {
        // Suppress the PHP warning, "It is not safe to rely on the system's
        // timezone settings".
        $currentTz = @date_default_timezone_get();
        if ($currentTz !== 'UTC') {
            return $currentTz;
        }

        if (ini_get('date.timezone')) {
            return ini_get('date.timezone');
        }

        if (getenv('TZ')) {
            return (string) getenv('TZ');
        }

        if ($systemTz = self::detectSystemTimezone()) {
            return $systemTz;
        }

        return $currentTz;
    }