pspp-dev
[Top][All Lists]
Advanced

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

Re: src/data/calendar.c


From: Ben Pfaff
Subject: Re: src/data/calendar.c
Date: Mon, 27 Mar 2006 12:19:18 -0800
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

John Darrington <address@hidden> writes:

> /* Takes a count of days from 14 Oct 1582 and returns the
>    corresponding weekday 1...7, with 1=Sunday. */
> int
> calendar_offset_to_wday (int ofs)
> {
>   int wday = (ofs - EPOCH + 1) % 7 + 1;
>   if (wday <= 0)
>     wday += 7;
>   return wday;
> }
>
>
> Can the the condition in the above IF statement ever be true?  So far
> as I can tell, only if the ofs < (EPOCH - 1) but dates before EPOCH
> are not permitted.

I think that the function, as is, works for any value of `ofs'.
On those grounds, I don't think changing the adjustment to an
assertion would really be an improvement.
-- 
"If a person keeps faithfully busy each hour of the working day, he
 can count on waking up some morning to find himself one of the
 competent ones of his generation."
--William James




reply via email to

[Prev in Thread] Current Thread [Next in Thread]