unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 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

* Re: [Emacs-diffs] master 46df7bb 03/12: Add new function time-zone-format
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2019-08-01  2:25 UTC (permalink / raw)
  To: Basil L. Contovounesios, emacs-devel; +Cc: Lars Ingebrigtsen

Basil L. Contovounesios wrote:
> Can't this (and its extension in a subsequent commit) be written in
> terms of, or replaced by, format-time-string?

Right you are. I replaced (time-zone-format zone t) with (format-time-string 
"%z" nil zone). It's not clear we need a separate time-zone-format function so I 
undid that for now.



^ 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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).