cal: First day of the week

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

The 'cal' utility assumes that week begins on Sunday, if not explicitly
told otherwise with the -m option.  In cal.c, there is code for
determining the first day of week from locale, but the code is commented
out.  I think it is about time to uncomment this piece of code and start
obeying the locale.

The piece of code is accompanied by a lengthy philosophical paragraph
about first day of week, which I'll quote and comment here:

---

> #if 0 /* setting week1stday is against man page */

I assume the man page can be easily altered.

> * What *is* the first day of the week? Note that glibc does not
> * provide any information today, it (almost) always answers Monday.

I realize that this text was probably written a long time ago. Today,
the glibc localedata does contain information about the first day of
week for over 30 locales.

> * Sometimes an answer is built into the language:
> * German calls Wednesday "Mittwoch", so starts at Sunday.

Whatever the etymology of weekday names might be, that doesn't change
the fact that in German calendars week begins on Monday.  The same
applies to Finnish, regardless of the literal meaning of the word.

> * The traditional Unix cal utility starts at Sunday.
> * We start at Sunday and have an option -m for starting at Monday.

Unix was written in United States, so it is not surprising if some
US-centric assumptions were made.  Do we have to suffer from them 40
years later?

---

It is worth mentioning that Debian uses some other cal implementation,
which does determine the first day of week from locale.

Also worth noting is that if/when someone chooses to uncomment code in
cal.c, the day will be off by one, because in the locale data Sunday=1,
Monday=2, while cal.c assumes the C-style Sunday=0, Monday=1.


Cheers,
-LN


--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux