Time and UTC problems

I have a time that is read in to the Time class. The time is UTC but
Ruby doesn’t know that. I can’t figure out how to make it UTC.

Details

  1. The date is read from a photo file, e.g. a jpg, that has EXIF
    information including the time that it was taken and my camera is always
    on UTC. The gem mini_exiftool reads in the date that the photo was
    captured. And the class is Time. That part of the script and the result

fileEXIF = MiniExiftool.new(fn)
fileDateUTC = fileEXIF.dateTimeOriginal
puts "fileDateUTC: #{fileDateUTC}. fileDateUTC.class:
#{fileDateUTC.class}. "

fileDateUTC: Thu Oct 14 09:46:22 -0700 2010. fileDateUTC.class: Time.

BTW, that time is really UTC even though it says GMT -7 (GMT -7 being
the time for the computer, not the photo). The photo was taken at
15:31:22 in Nepal which is GMT +5.75

How do I tell Ruby that the time is UTC? I could work with the time
coerced to DateTime, but can’t figure out how to do that.

Thanks for any advice.

PS I’m very much a newbie with very limited programming experience.

t = Time.now
puts t
puts Time.utc(*t.to_a)

–output:–
2011-07-22 19:25:26 -0700
2011-07-22 19:25:26 UTC

This is the shortest way I’ve ever seen to solve this problem. Well
done, sir.

~ jf

John F.
Principal Consultant, BitsBuilder
LI: http://www.linkedin.com/in/johnxf
SO: User John Feminella - Stack Overflow