From: Thorsten Glaser <tg@mirbsd.de>
To: musl@lists.openwall.com
Subject: Re: [musl] strptime(s, "%Y-%j", &tm) does not update month and day
Date: Mon, 13 May 2024 21:18:21 +0000 (UTC) [thread overview]
Message-ID: <Pine.BSM.4.64L.2405132116570.17030@herc.mirbsd.org> (raw)
In-Reply-To: <20240513121802.GX10433@brightrain.aerifal.cx>
Rich Felker dixit:
>if you assume POSIX-compatible time_t, just adding 86400*tm_yday to
>the time_t.
AIUI, POSIX (Issue 8) suggests to add 86400*tm_yday to tm_sec and
using mktime to normalise it.
If you don’t start at 00:00:00 UTC, it should even work for systems
that honour leap seconds (say start at 1st January, 12:00:00 UTC;
the result may than be not at 12:00:00, but the day should be right).
bye,
//mirabilos
--
“It is inappropriate to require that a time represented as
seconds since the Epoch precisely represent the number of
seconds between the referenced time and the Epoch.”
-- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2
prev parent reply other threads:[~2024-05-13 21:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-11 15:24 Petr Pisar
2024-05-11 21:28 ` Rich Felker
2024-05-12 7:54 ` Petr Pisar
2024-05-13 12:18 ` Rich Felker
2024-05-13 21:18 ` Thorsten Glaser [this message]
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=Pine.BSM.4.64L.2405132116570.17030@herc.mirbsd.org \
--to=tg@mirbsd.de \
--cc=musl@lists.openwall.com \
/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 public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).