```ruby
class ApplicationController < ActionController::Base
  include Authentication

  before_filter :authenticate
  before_filter :adjust_format_for_iphone
  before_filter :adjust_time_zone, :if => :signed_in?

  protect_from_forgery

  protected

  def adjust_format_for_iphone
    user_agent = request.env['HTTP_USER_AGENT']

    if user_agent.present? && user_agent =~ /(iPhone)/
      request.format = :iphone
    end
  end

  def adjust_time_zone
    Time.zone = current_user.time_zone
  end
end
```

Use an around_filter for adjusting the time zone.
user
```ruby
class ApplicationController < ActionController::Base
  include Authentication

  before_filter :authenticate
  before_filter :adjust_format_for_iphone
  around_filter :adjust_time_zone, :if => :signed_in?

  protect_from_forgery

  protected

  def adjust_format_for_iphone
    user_agent = request.env['HTTP_USER_AGENT']

    if user_agent.present? && user_agent =~ /(iPhone)/
      request.format = :iphone
    end
  end

  def adjust_time_zone
    Time.zone = current_user.time_zone
    yield
  ensure
    Time.zone = "UTC"
  end
end
```
assistant