Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
strftime.3: clarify %G and %g description
To:
tech@openbsd.org
Cc:
Todd Miller <millert@openbsd.org>, Ingo Schwarze <schwarze@openbsd.org>, Lucas Gabriel Vuotto <lucas@sexy.is>
Date:
Tue, 23 Apr 2024 21:43:44 +0200

Download raw body.

Thread
Lucas Gabriel Vuotto just pointed out that got(1) was mistakenly
using %G to get the year with strftime().  This is a trap set by a
poor description in our strftime.3.  I suggest the clarification
below, taken from FreeBSD.

OK?  Or would somebody like to suggest a better phrasing?

diff 72e8381b061ef8bfbfda8ae5f9e52236d32d958b 829b462fd20777939f32387f52e567ce9809330c
commit - 72e8381b061ef8bfbfda8ae5f9e52236d32d958b
commit + 829b462fd20777939f32387f52e567ce9809330c
blob - a2adf880bbe93ed8e05dc6b6d77989ea842152a9
blob + 03b5bba8db5407238445c218cbd7c3815413c992
--- lib/libc/time/strftime.3
+++ lib/libc/time/strftime.3
@@ -111,10 +111,14 @@ is replaced by the date in the format
 is replaced by the
 .St -iso8601
 year with century as a decimal number.
+This year is the one that contains the greater part of
+the week (Monday as the first day of the week).
 .It Cm \&%g
 is replaced by the
 .St -iso8601
 year without century as a decimal number (00\-99).
+This year is the one that contains the greater part of
+the week (Monday as the first day of the week).
 .It Cm \&%H
 is replaced by the hour (24-hour clock) as a decimal number (00\-23).
 .It Cm \&%I

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de