This is the mail archive of the libc-locales@sources.redhat.com mailing list for the GNU libc locales project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Talk about glibc locale format


On Tue, Jul 05, 2005 at 09:37:30PM +0200, Keld Jørn Simonsen wrote:
[...]
> Anyway,could the programmers of cal obtain the parameters of the week
> keyword and then handle the day names accordingly?
> Is this the problem, that they cannot obtain the "week" line in a
> reliable way?
> 
> Then one could ahve 3 keywords instead
> 
> weeklength  7               #  indicating a normal week length of 7 days)
> firstweekbegin 4            # a Thursday
> firstdayofweek 19971201     # a Monday
> 
> The cal programmer then needs to do some programming.

My example was not very good, one can indeed assume that cal writers
are able to make such date computations.  But the problem is that
ISO 14652 new definition is not compatible with "struct tm" as described
in http://www.opengroup.org/onlinepubs/009695399/basedefs/time.h.html
so any libc function (like gmtime, localtime, strftime,...) which work
with "struct tm" is no more POSIX compatible.  There are some side
effects, e.g. strftime %w would become locale-dependent.
OTOH if libc functions are not modified, all applications calling
these functions need to be modified.

This is very different from other changes, say in LC_COLLATE, because
new keywords in this section only modified the locale file format, not
libc API.

> It should be easy to determine what day the firstdayofweek is
> in the range 1 thru weeklength (normally Monday thru Sunday).
> 
> A calender should display the week number with the calender
> so that needs to be computed, the start of the first week.
> 
> Then the calender should be displayable. 
> 
> I don't think that you need more info than this, and all this is not
> really complicated.

This should be easy for cal writers, but I hope that any programer
wanting to display a date does not need to make such computations ;)

> But maybe people get confused by requiring Monday=1, Sunday=7 ?
> But this is standard ISO 8601, and what is the case in most of the
> world.

No, people get confused because:
  1. the definitions of day and abday are not compatible with POSIX.
  2. there is no implementation of this standard

> Given the importance of time and calendars, and also week numbers, 
> this is functionlity that should be implemented. Maybe there is better
> way to specify it, 
> 
> So you suggest other keywords?
> 
> Like:
> 
> intabday "ma","ti","on","to","fr","lø","sø"  # Danish
> 
> Should I then also have:
> 
> abday "sø","ma","ti","on","to","fr","lø"
> 
> That would seem completely unnecessary as just a duplication of the 
> "intabday" information. 

There are 2 distinct problems:
  a. How to specify first day of week?
  b. How to handle different calendars?
(a) could have been easily solved by setting first_weekday to a value
between 0 and 6 (i.e. with a semantics similar to %w, 0=Sunday ...
6=Saturday).  I have no idea about (b), people using these calendars
surely have some ideas.  And if nobody knows how to work with different
calendars, I would not try to standardize anything about that ;)

Denis


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]