...some notes on how the cameras handles dates/times - by reyalP, taken from this forum post.
- The following applies to both vxworks (a540) and dryos R31 (d10), except that a540 doesn't have DST or alternate timezone functions. Would be interesting to know if GPS enabled cams behave differently, since they do have an absolute time reference.
The timestamp returned by camera os.time is like a Unix timestamp, except it always treats the current camera time as UTC:
=return os.date('%c',0) 1:return:'Thu Jan 1 00:00:00 1970'
Switching to the alternate timezone on the camera UI changes the underlying timestamp (also timestamps recorded on the file, seen by stat):
Home timezone (PST):
con 4> =return os.date(),os.time() 5:return:'Sat Jan 28 16:01:58 2012' 5:return:1327766518
Alternate timezone (IST, yes, it really is :30 off):
con 5> =return os.date(),os.time() 6:return:'Sun Jan 29 05:32:49 2012' 6:return:1327815169
- Exif values appear to be a straight strftime on the camera.
Assuming your camera and PC are set to the same local time, you just need the offset of PC local time from UTC in seconds to add or subtract. In PC side lua this can be obtained with
local tslocal=os.time() local ttmp = os.date('!*t',tslocal) ttmp.isdst = os.date('*t',tslocal).isdst return tslocal - os.time(ttmp)
- If your camera time changes (due to using travel time zone, DST option, or setting the clock) there's really no way to recover the absolute time unless you kept track externally.
You can display a camera time in local PC time by pretending PC current timezone is UTC:
=return os.date('%c',1327766494) 1:return:'Sat Jan 28 16:01:34 2012'
!return os.date("%c",1327766494) ="01/28/12 08:01:34"
!return os.date("!%c",1327766494) ="01/28/12 16:01:34"
(! in lua os.date means display UTC... this doesn't work on the camera, of course)