title: Change Time zone in pure ruby (not rails)
body: <p>I am building a Sinatra site which has mixed UTC/PST data sources, but will be viewed in PST. So I need a way to easily convert Time objects from UTC to PST. 
  Without Rails, I don't have access to <code>Time.zone</code>, <code>in_time_zone</code>, etc. </p>
  
  <p>I only need to change the timezone of a Time object, E.g. <code>2014-08-14 21:44:17 +0000 =&gt; 2014-08-14 14:44:17 -0700.</code></p>
  
  <p>First I tried this: </p>
  
  <pre><code>class Time
    def to_pst
      self.utc + Time.zone_offset('PDT')
    end
  end
  </code></pre>
  
  <p>But this changes the actual timestamps and not the zone. I need both <code>time.to_i</code> and <code>time.strftime</code> to work; so I can't change the absolute value of the timestamps. </p>
  
  <pre><code>&gt; t = Time.now
  =&gt; 2014-08-14 21:46:20 +0000
  &gt; t.to_pst
  =&gt; 2014-08-14 14:46:20 UTC
  &gt; t.to_i
  =&gt; 1408052780
  &gt; t.to_pst.to_i
  =&gt; 1408027580
  </code></pre>
  
  <p><a href="https://rubygems.org/gems/timezone" rel="noreferrer">gem 'timezone'</a> presents a similar problem.</p>
  
  <p><a href="http://www.java2s.com/Code/Ruby/Time/Converttimetotimezone.htm" rel="noreferrer">This</a> solution works but alters global variables and is not thread-safe.</p>
  
  <p>The OS time zone needs to stay UTC. </p>
  
  <p>I simply need a way to change the Time zone on a single Time object. This is a simple problem and it seems like it should have a simple solution! Has anyone found one? Thanks in advance!</p>