Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Mon, 13 May 2024 21:18:21 +0000 (UTC)
From: Thorsten Glaser <>
Subject: Re: strptime(s, "%Y-%j", &tm) does not update month and day

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).

“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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.