This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Incorrect first_weekday for POSIX locale
- From: Petter Reinholdtsen <pere at hungry dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Sat, 17 Jul 2004 10:23:10 +0200
- Subject: Re: Incorrect first_weekday for POSIX locale
- References: <E1BQCa3-0003Vl-00@minerva.hungry.com><2fly8nf5sdv.fsf@saruman.uio.no> <2flvfgqsnlu.fsf@saruman.uio.no><20040714152541.GA28888@rap.rap.dk>
[Keld Jørn Simonsen]
> Sunday should have the value 0 - not 1, which is the value for monday.
Eh, I must have misunderstood how this work. Can you show me a code
example on how to calculate the day of week for the first weekday?
I based my conclusion on
<URL:http://www.dkuug.dk/JTC1/SC22/WG20/docs/n972-14652ft.pdf>, where
I read the following:
week Is used to define the number of days in a week, and which
weekday is the first weekday (the first weekday has the value
1), and which week is to be considered the first in a
year. The first operand is an integer specifying the number of
days in the week. The second operand is an integer specifying
the Gregorian date in the format YYYYMMDD, and it specifies a
day that is a first weekday (all other first weekdays may then
be calculated by adding or subtracting a whole multiplum of
the number of days in the week as specified with the first
operand). The third operand is an integer specifying the
weekday number to be contained in the first week of the
year. The third operand may also be understood as the number
of days required in a week for it to be considered the first
week of the year. If the keyword is not specified the values
are taken as 7, 19971130 (a Sunday), and 7 (Saturday),
respectively. ISO 8601 conforming applications should use the
values 7, 19971201 (a Monday), and 4 (Thursday),
respectively. This keyword is optional.
So if 19971130 is a Sunday, and '7' counted from thas date is a
Saturday, the previous Sunday would use the value '1'. Where did I
misunderstand?