help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Formatting time as local time?


From: Tim X
Subject: Re: Formatting time as local time?
Date: Wed, 08 Dec 2010 15:16:36 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Elena <egarrulo@gmail.com> writes:

> Thanks Tim. Indeed "(current-time-zone)" showed my timezone was +0000.
>
> Now I have to make sense of using the "TZ" environment variable and
> "(set-time-zone-rule)". It seems I can't get sensible results. Here is
> what I think I should use:
>
>   (setenv "TZ" "Europe/Rome") ;; I don't know whether this value is
> correct, since I can't find a list of values.
>   (set-time-zone-rule "GMT+1")
>   (format-time-string "%a, %e %b %Y %T %Z" (nth 5 (file-attributes my-
> file-name)) nil) ;; nil -> Local Time
>
> However I'm getting a wrong local time (three hours before the correct
> one).
>
> OS is Windows XP.

Unfortunately, I know absolutely nothing about windows. However, in
principal, your OS should be setting the TZ and then emacs picking up
that setting. 

In general, the standard approach is to have your hardware clock set to
UTC time and then have your timzone and locale take care of
determination of local  time and format etc. 

Provided your OS is correctly configured, emacs *should* just pick up
the necessary information from your environment. I'm afraid you need
someone more informed wrt windows to really help. 

Make sure you indicate what version of emacs you are using. If it is a
recent dev version, this could be a bug. 

Tim


-- 
tcross (at) rapttech dot com dot au


reply via email to

[Prev in Thread] Current Thread [Next in Thread]