all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: emacs-devel@gnu.org
Cc: Lars Ingebrigtsen <larsi@gnus.org>
Subject: Re: [Emacs-diffs] master 46df7bb 03/12: Add new function time-zone-format
Date: Thu, 01 Aug 2019 02:20:26 +0300	[thread overview]
Message-ID: <87y30dx03p.fsf@tcd.ie> (raw)
In-Reply-To: <20190731194757.DA2E121130@vcs0.savannah.gnu.org> (Lars Ingebrigtsen's message of "Wed, 31 Jul 2019 15:47:57 -0400 (EDT)")

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



       reply	other threads:[~2019-07-31 23:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190731194754.728.72904@vcs0.savannah.gnu.org>
     [not found] ` <20190731194757.DA2E121130@vcs0.savannah.gnu.org>
2019-07-31 23:20   ` Basil L. Contovounesios [this message]
2019-08-01  2:25     ` [Emacs-diffs] master 46df7bb 03/12: Add new function time-zone-format Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y30dx03p.fsf@tcd.ie \
    --to=contovob@tcd.ie \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.