* Re: [Emacs-diffs] master 46df7bb 03/12: Add new function time-zone-format
[not found] ` <20190731194757.DA2E121130@vcs0.savannah.gnu.org>
@ 2019-07-31 23:20 ` Basil L. Contovounesios
2019-08-01 2:25 ` Paul Eggert
0 siblings, 1 reply; 2+ messages in thread
From: Basil L. Contovounesios @ 2019-07-31 23:20 UTC (permalink / raw)
To: emacs-devel; +Cc: Lars Ingebrigtsen
larsi@gnus.org (Lars Ingebrigtsen) writes:
> branch: master
> commit 46df7bbe12cce4c9af7ce4357aa9f8d36c1d8933
> Author: Lars Ingebrigtsen <larsi@gnus.org>
> Commit: Lars Ingebrigtsen <larsi@gnus.org>
>
> Add new function time-zone-format
>
[...]
> +(defun time-zone-format (seconds)
> + "Format SECONDS as a valid time zone string.
> +For instance, 3600 is \"+01:00\"."
> + (format "%s%02d:%02d"
> + (if (< seconds 0)
> + "-"
> + "+")
> + (/ (abs seconds) 3600)
> + (mod (abs seconds) 3600)))
> +
Can't this (and its extension in a subsequent commit) be written in
terms of, or replaced by, format-time-string?
(format-time-string "%:z" nil 3600) ; => "+01:00"
(format-time-string "%:z" nil -7200) ; => "-02:00"
(format-time-string "%z" nil 3600) ; => "+0100"
(format-time-string "%z" nil -7200) ; => "-0200"
Thanks,
--
Basil
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-01 2:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20190731194754.728.72904@vcs0.savannah.gnu.org>
[not found] ` <20190731194757.DA2E121130@vcs0.savannah.gnu.org>
2019-07-31 23:20 ` [Emacs-diffs] master 46df7bb 03/12: Add new function time-zone-format Basil L. Contovounesios
2019-08-01 2:25 ` Paul Eggert
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.