Hi Alex,

Thanks a lot for your reply!

/Jon

Hi Jon,

 and time of the file "CHANGES", I get "2008-04-23 16:29:06", and this
 should be the UTC date and time.

Right. 'info' returns the time in UTC.

I think it would be too much trouble to change 'info' or write a similar
function in C.

I would recommend to write a function that calculates the offset of the
current time zone. You could, for example, parse the output of the
'date' command like

   : (in '(date "+%:z") (line))
   -> ("+" "0" "2" ":" "0" "0")

or

   : (in '(date "+%z") (read))
   -> 200

but I think it is more efficient to call the built-in 'date' function
twice, once without arguments to get the local time, and once with 'T'
to get UTC. Then round the difference to compensate for a possible time
lag between these two calls.

   (de tzOffset ()  # Return the time zone offset in seconds
      (* 60                                        # Round to whole minutes
         (*/
            (-                                     # The difference of
               (+ (* 86400 (date)) (time T))       # local time in seconds
               (+ (* 86400 (date T)) (time T)) )   # and UTC in seconds
            60 ) ) )

Then you could output the desired file date in local time in this way

   : (when (info "CHANGES")
      (let Tim
         (+
            (+ (* 86400 (cadr @)) (cddr @))
            (tzOffset) )
         (stamp (/ Tim 86400) (% Tim 86400)) ) )
   -> "2008-04-23 18:29:06"

Cheers,
- Alex
--
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Reply via email to