current-time

Yuuichi Teranishi teranisi @ gohome.org
1999年 12月 10日 (金) 16:48:37 JST


At Fri, 10 Dec 1999 16:15:08 +0900,
Mito <mit @ nines.nec.co.jp> wrote:
> 
> > あ、JST でしか正しく動きませんね...(current-time-string も)。
> > やっぱり current-time-zone みたいな変数を設けるしかないかなぁ。
> 
> # typo かな?
> 
> current-time は time(2) の戻り値を使っていたはずなんで、
> TZ=UTC でしか正しく動かないと思います。

いえ、Mito さんの実装を何にも考えずに展開した結果、
ハードコーディングで JST の差だけ (9 * 60 * 60 = 32400 秒) 
引いた値を出すようになってしまっているので(すみません)、
JST でしか正しく動かないと思われます。

ところで、Nemacs で現在のタイムゾーンを簡単に得る方法はあるでしょうか?

今思いついた方法:
(with-temp-buffer
 ;; それこそ locale の問題がありそう...。
 (call-process "date" nil (current-buffer) t)
 (goto-char (point-min))
 (let ((case-fold-search nil))
   (if (re-search-forward "\\([A-Z][A-Z][A-Z]\\)" nil t)
       (buffer-substring (match-beginning 1)(match-end 1)))))

--
Yuuichi Teranishi (寺西裕一) <teranisi @ gohome.org>
PGP 5.0i Public Key: http://www.gohome.org/pgp5/teranisi.key
"Living is easy with eyes closed, misunderstanding all you see..."




More information about the APEL-ja mailing list