From: Dr J R Stockton on

I have found some faults in one section of both an ancient and a fairly
recent copy of the comp.unix.shell FAQ .

Referring to <http://www.chinaunix.net/jh/24/551026.html>, FAQ lines
indented as published, my lines begin '**'.

6 d. Determining leap year
A leap year in the Gregorian calendar is defined as a year which
is evenly divisible by 4, however, if it's also evenly divisible
by 100 then it's not a leap year unless it's also evenly
divisible by 400. It gets worse than that, actually, but this
is as far as I go :-).
** It does not get worse. 4/100/400 represents the full Gregorian rule;
** anything else is at best a proposal.


In the Julain calendar which was used before in Europe, only the
years divisible by 4 where leap years.
** Spelling : Julian, were.
** It was not used only in Europe, but (at least) in all the various
** European colonies.

The standard "cal" utility performed the switch between Julian
and Gregorian calendar in september 1752 (see cal 9 1752) which
corresponds to the date used in England. The Gregorian calendar
** in Britain and colonies
(created by Pope Gregory III) was first used in 1582 in many
other countries.
** Gregory XIII. Clavius /et al/ created it; the Pope wanted and
** decreed it.
** Not *many* in 1582. Read The Calendar FAQ.


** ISO Week Numbering and Date of Easter, for which my site has
** algorithms, could be added.

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.
From: bsh on
On 2010-03-23, Dr J R Stockton <reply1...(a)merlyn.demon.co.uk> wrote:
> I have found some faults in one section of both an ancient and a fairly
> recent copy of the comp.unix.shell FAQ.
> Referring to <http://www.chinaunix.net/jh/24/551026.html>, FAQ lines
> indented as published, my lines begin '**'.

This mirror of the FAQ maintained by Joe Halpin, based on the FAQ
maintained by, IIRC, Dana French, is now obsolete. The new FAQ,
which is already obsolete in regard to missing some discussion of
issues regarding features in the newest versions of ksh93, is:

http://kornshell.com/doc/faq.html

> 6 d. Determining leap year
> A leap year in the Gregorian calendar is defined as a year which
> is evenly divisible by 4, however, if it's also evenly divisible
> by 100 then it's not a leap year unless it's also evenly
> divisible by 400. It gets worse than that, actually, but this
> is as far as I go :-).
> ** It does not get worse. 4/100/400 represents the full Gregorian rule;
> ** anything else is at best a proposal.

Yes, it gets worse than that :) insofar as there are _three_
contentious algorithms for the calculation of leap year, the
stated, and usual one, being the above, being the least accurate.

Proposals, to be sure, but a code library _must_ make it clear
as to which standard is used to make the calculation.

> In the Julain calendar which was used before in Europe, only the
> years divisible by 4 where leap years.

Sort of. The Julian Calendar, which really should have been called
the Cleopatran Calendar, insofar as it was _itself_ a calendrical
fix suggested by that ruler, codified by her Alexandrian court
astronomer Sosigenes, and mandated by Gaius Julius Optimate -- that
is, before he was Caesar -- had further difficulties at its inception
because of an error of implementation essentially making the first
few leap years every three years, not four. This has to be taken into
account by software that does proleptic calendrical calculation,
including that for Julian days, by which you probably mean the
Modified Julian Day Number, or even the Astronomical Julian Day,
being modern refinements of the JDN, which itself increments at
noon, not midnight.

Indeed, if we are talking about day-day demarcations, which is what
the JDN is all about, discussion has to made of the 22+ leap-seconds
that have been inserted into the calendar since 1970, which could
(or have?) appear on the ISO-standard 61th second (!) of 11:59pm,
theoretically erroneously shifting the determination of a given
day.

Calendrical calculation is _incredibly_ nuanced, and best left to
external validated and vetted software tools. The layman would never
think of such things as why the length of a day (which is _always_
different) is dependant on the relative time that the northern
and southern hemispheres spend in that year's winter! (*) No
wonder why the JDN was instigated!

> ** Spelling : Julian, were.
> ** It was not used only in Europe, but (at least) in all the various
> ** European colonies.
> The standard "cal" utility performed the switch between Julian
> and Gregorian calendar in september 1752 (see cal 9 1752) which
> corresponds to the date used in England. The Gregorian calendar
> ** in Britain and colonies
> (created by Pope Gregory III) was first used in 1582 in many
> other countries.
> ** Gregory XIII. Clavius /et al/ created it; the Pope wanted and
> ** decreed it.
> ** Not *many* in 1582.

You are correct that this is incredibly naive of the cal(1)
software tool. 25 countries and provinces have adopted the
Gregorian calendar on 18 different dates, ranging from the
year 1582 to as late as 1949.

> ** ISO Week Numbering and Date of Easter, for which my site has
> ** algorithms, could be added.

This should not be part of the FAQ, insofar as it is an
user's implementation issue. There are plenty of function
libraries for such calculations in shellscript, and
mentioning pointers to some is sufficient for inclusion in
the FAQ.

=Brian

(*) Because the majority of tall mountains in the world are in
the northern hemiphere, inordinate time spend in winter from one
year to the next will mean greater deposits of high-altitude snow
and ice, the distal weight of which will slow the earth's revolutions
to a very measurable degree!
From: Ed Morton on
On 3/23/2010 9:49 PM, bsh wrote:
> On 2010-03-23, Dr J R Stockton<reply1...(a)merlyn.demon.co.uk> wrote:
>> I have found some faults in one section of both an ancient and a fairly
>> recent copy of the comp.unix.shell FAQ.
>> Referring to<http://www.chinaunix.net/jh/24/551026.html>, FAQ lines
>> indented as published, my lines begin '**'.
>
> This mirror of the FAQ maintained by Joe Halpin, based on the FAQ
> maintained by, IIRC, Dana French, is now obsolete. The new FAQ,
> which is already obsolete in regard to missing some discussion of
> issues regarding features in the newest versions of ksh93, is:
>
> http://kornshell.com/doc/faq.html
>

Hmmm, never heard of it. I thought the FAQ was at
http://cfajohnson.com/shell/cus-faq.html these days.

Ed.
From: Dr J R Stockton on
In comp.unix.shell message <hoc48j$9f9$1(a)news.eternal-september.org>,
Tue, 23 Mar 2010 23:25:54, Ed Morton <mortonspam(a)gmail.com> posted:
>On 3/23/2010 9:49 PM, bsh wrote:
>> On 2010-03-23, Dr J R Stockton<reply1...(a)merlyn.demon.co.uk> wrote:
>>> I have found some faults in one section of both an ancient and a fairly
>>> recent copy of the comp.unix.shell FAQ.
>>> Referring to<http://www.chinaunix.net/jh/24/551026.html>, FAQ lines
>>> indented as published, my lines begin '**'.
>>
>> This mirror of the FAQ maintained by Joe Halpin, based on the FAQ
>> maintained by, IIRC, Dana French, is now obsolete. The new FAQ,
>> which is already obsolete in regard to missing some discussion of
>> issues regarding features in the newest versions of ksh93, is:
>>
>> http://kornshell.com/doc/faq.html
>>
>
>Hmmm, never heard of it. I thought the FAQ was at http://cfajohnson.com
>/shell/cus-faq.html these days.

That seems to match what I was commenting on.

Additionally, in "f. Determining the day of the week for a given date.",
function dayofweek, consider the line
D=$(( $A + $B + $C + $d + $y - ($c * 2) ))
That's OK later in each century. But in & soon after March early in a
century, the $c term becomes larger than the sum of the rest, and D
becomes negative. The next line is
echo $(( $D % 7 ))
and the result in at least some languages is unsatisfactory for D<0. An
efficient remedy is to change - ($c * 2) to + ($c * 5) in the D
expression (see my Zeller pages). However, that should be verified in a
Unix shell.

In the first paragraph of "g. Arbitrary date arithmetic", two "GMT" are
required. The error will hit resident Americans when they think it is
still 1/18/2038.


--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.
From: Dr J R Stockton on
In comp.unix.shell message <d8e9a935-8f20-4345-8e5c-dd34e125f2a4(a)y11g200
0prf.googlegroups.com>, Tue, 23 Mar 2010 19:49:50, bsh
<brian_hiles(a)rocketmail.com> posted:
>On 2010-03-23, Dr J R Stockton <reply1...(a)merlyn.demon.co.uk> wrote:
>> I have found some faults in one section of both an ancient and a fairly
>> recent copy of the comp.unix.shell FAQ.
>> Referring to <http://www.chinaunix.net/jh/24/551026.html>, FAQ lines
>> indented as published, my lines begin '**'.
>
>This mirror of the FAQ maintained by Joe Halpin, based on the FAQ
>maintained by, IIRC, Dana French, is now obsolete. The new FAQ,
>which is already obsolete in regard to missing some discussion of
>issues regarding features in the newest versions of ksh93, is:
>
>http://kornshell.com/doc/faq.html

That is, currently, a dismal document : no date, no named author, and
apparently only one shell.

>
>> 6 d. Determining leap year
>> A leap year in the Gregorian calendar is defined as a year which
>> is evenly divisible by 4, however, if it's also evenly divisible
>> by 100 then it's not a leap year unless it's also evenly
>> divisible by 400. It gets worse than that, actually, but this
>> is as far as I go :-).
>> ** It does not get worse. 4/100/400 represents the full Gregorian rule;
>> ** anything else is at best a proposal.
>
>Yes, it gets worse than that :) insofar as there are _three_
>contentious algorithms for the calculation of leap year, the
>stated, and usual one, being the above, being the least accurate.
>
>Proposals, to be sure, but a code library _must_ make it clear
>as to which standard is used to make the calculation.


There is only two true standards for the secular Gregorian Calendar :
one is the Papal Bull of 1582 (a.k.a. 1581) issued by Gregory XIII
(Easter is defined in the Six Canons and the Explicatio of Clavius). A
modified calendar could only be Gregorian if it were issued by a later
Pope Gregory, or some other authority of that name. The other is the
British Calendar Act of 1751 for Leap Year, and its Annex for Easter.

Our full secular current calendar is also defined in ISO 8601.

Proposals are not standards. Those will not be implemented in our time;
and, if they were, the result would not be Gregorian.


>> In the Julain calendar which was used before in Europe, only the
>> years divisible by 4 where leap years.
>
>Sort of. The Julian Calendar, which really should have been called
>the Cleopatran Calendar, insofar as it was _itself_ a calendrical
>fix suggested by that ruler, codified by her Alexandrian court
>astronomer Sosigenes, and mandated by Gaius Julius Optimate -- that
>is, before he was Caesar -- had further difficulties at its inception
>because of an error of implementation essentially making the first
>few leap years every three years, not four. This has to be taken into
>account by software that does proleptic calendrical calculation,
>including that for Julian days, by which you probably mean the
>Modified Julian Day Number, or even the Astronomical Julian Day,
>being modern refinements of the JDN, which itself increments at
>noon, not midnight.

Partially true. The Julian Calendar, used from about BC 45, has a Leap
Year *every* 4 years. The implementation errors did not affect the
calendar of the Emperor Caesar; they merely affected the Roman civil
calendar. And more than half of Europe was unaffected; essentially only
France, most of Spain, Italy, Greece, and the coast in between in 44 BC,
with Switzerland to the Balkans being added by 14 AD.



>Indeed, if we are talking about day-day demarcations, which is what
>the JDN is all about, discussion has to made of the 22+ leap-seconds
>that have been inserted into the calendar since 1970, which could
>(or have?) appear on the ISO-standard 61th second (!) of 11:59pm,
>theoretically erroneously shifting the determination of a given
>day.

Only if the day is determined as if by a SI clock. The traditional
method is to rely on the alternating light and dark. Before worrying
about the occasional +- 1 second, one should consider the Equation of
Time, which affected the length of the civil day until good clocks were
in use.

The only errors deserving correction in that part are the spelling.


>Calendrical calculation is _incredibly_ nuanced, and best left to
>external validated and vetted software tools. The layman would never
>think of such things as why the length of a day (which is _always_
>different) is dependant on the relative time that the northern
>and southern hemispheres spend in that year's winter! (*) No
>wonder why the JDN was instigated!

No; the length of a civil day is 86400 +- 1 SI seconds, +- 0.5 or 1
hour.

But that has nothing to do with the calendar, which is a means of
labelling a sequence of days independently of how their bounds are
determined.


>> ** Spelling : Julian, were.
>> ** It was not used only in Europe, but (at least) in all the various
>> ** European colonies.
>> The standard "cal" utility performed the switch between Julian
>> and Gregorian calendar in september 1752 (see cal 9 1752) which
>> corresponds to the date used in England. The Gregorian calendar
>> ** in Britain and colonies
>> (created by Pope Gregory III) was first used in 1582 in many
>> other countries.
>> ** Gregory XIII. Clavius /et al/ created it; the Pope wanted and
>> ** decreed it.
>> ** Not *many* in 1582.
>
>You are correct that this is incredibly naive of the cal(1)
>software tool.

No; I'm not commenting on the tool (and so cannot be right or wrong
about it), but on what that FAQ actually says.


> 25 countries and provinces have adopted the
>Gregorian calendar on 18 different dates, ranging from the
>year 1582 to as late as 1949.

That cannot be correct. There is now of the order of 200 countries, all
using the Gregorian Calendar (some use other calendars as well). ALL
have adopted the Gregorian Calendar on or since (approximately, allowing
for longitude) JD 2299160.5. The number of countries that changed from
Julian to Gregorian is of course smaller.


>> ** ISO Week Numbering and Date of Easter, for which my site has
>> ** algorithms, could be added.
>
>This should not be part of the FAQ, insofar as it is an
>user's implementation issue. There are plenty of function
>libraries for such calculations in shellscript, and
>mentioning pointers to some is sufficient for inclusion in
>the FAQ.

Of course - provided that it is certain that the ones pointed to are
both correct and reasonably efficient (preferably directly traceable to
the original authority, which is rarely the case for Easter) and that
either they are full-range (to within the limits of the machine's
arithmetic capability) or that their limits are clearly stated within
the code.

Be aware that, for example, Microsoft got ISO Week Numbering wrong, and
have not corrected the distribution for over half a decade after they
put "bug-fix" code (an appalling implementation) on their Web site; and
Gauss got Easter wrong at first. So it would be unsafe to assume that
anything found on the Web or in libraries is necessarily correct.

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.
 |  Next  |  Last
Pages: 1 2 3 4
Prev: Bulk moving of files
Next: B.C. and A.L.