[Top][All Lists]

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

Re: format-time-string bug

From: Kenichi Handa
Subject: Re: format-time-string bug
Date: Tue, 13 Apr 2004 10:49:43 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.3 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

In article <address@hidden>, Marcelo Toledo <address@hidden> writes:

> A few days ago I was coding something related to time, then I needed to
> use the function `format-time-stringĀ“ and the code above shows what I
> have found wrong:

> (setq t1 (current-time))
> (sleep-for 3)
> (setq t2 (current-time))
> (format-time-string "(%H:%M:%S)" (time-subtract t2 t1))

> the result of the last expression should be something near 00:00:03.

> For me it is appearing 20:00:03. For other people it's appearing
> diferent values but never what I am really expecting. Could someone
> please try?

20:00:03 is the correct value for you because it seems that
your timezone is -0400.  As I'm in JST, I get "09:00:03".
If you want "00:00:03", you must call format-time-string as

> (format-time-string "(%H:%M:%S)" (time-subtract t2 t1) t)

By the way, format-time-string is for time, not for a

Ken'ichi HANDA

reply via email to

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