V Sat, May 11, 2024 at 05:28:54PM -0400, Rich Felker napsal(a): > On Sat, May 11, 2024 at 05:24:59PM +0200, Petr Pisar wrote: > > Hello, > > > > When debugging a libisds test failure with musl-1.2.5 > > , I found that musl's > > strptime() does not handle "%Y-%j" properly. It accepts the format, it parses > > the input string, it returns a correct pointer past the input string, but it > > does not update tm.tm_mon and tm.tm_mday fileds of the third argument. > > This is behaving as specified. Previously, the behavior was > unspecified. POSIX has amended it for future issues as the resolution > of https://austingroupbugs.net/view.php?id=1727 to read: > > The tm_yday member of the tm structure pointed to by tm shall be > set to this number minus 1. > > strptime generally does not behave like mktime, doing > normalizations/conversions. > I see. I thought that strptime() does the normalization. Reading mktime() specification reveals it has a side effect of normalizing tm_yday from tm_year, tm_mon, and tm_mday. However, I need the oposite and I cannot find any standard library function for that. I will probaly resort to my own implementation with the drawback of assumption that rules for leap years in Gregorian calendar won't change. -- Petr