[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH]: Re: Date processing should be more flexible

From: Christopher Ness <chris_at_nesser.org>
Date: 2005-07-05 05:41:13 CEST

Dropping users list.

On Tue, 2005-07-05 at 06:21 +0300, Christer J. Nyfält wrote:
> On Mon, 2005-07-04 at 22:56 -0400, Christopher Ness wrote:
> > This patch also forces the day to be greater than 0. Not sure if this
> > will break any scripts, but a day of 0 didn't make sense to me.
> >
> /* Range validation, allowing for leap seconds */
> if (expt.tm_mon < 0 || expt.tm_mon > 11
> || expt.tm_mday > valid_days_by_month[expt.tm_mon]
> + || expt.tm_mday <= 0
> || expt.tm_hour > 23
> || expt.tm_min > 59
> || expt.tm_sec > 60)
>
> If valid months go from 0 to 11, wouldn't that mean that the internal
> representation of months are real month number - 1? That makes me
> suspect that the same case could be true for days also.
> Or in short, have you checked that the first of a month is tm_mday == 1
> and not tm_mday == 0?

Good question, I assumed the input came in from the CLI arguments
unchanged and was [1,n] where n is defined in (static int
valid_days_by_month[]). Now I've looked more closely and verified this
is true.

After a template is matched two modifications take place to the outgoing
record, one to the year and the other to the month. The day is passed
through unmodified.

  8333 kfogel expt.tm_year -= 1900;
  8333 kfogel expt.tm_mon -= 1;

Cheers,
Chris

-- 
PGP Public Key: http://www.nesser.org/pgp-key/
23:30:39 up 3:03, 4 users, load average: 0.42, 0.15, 0.10

Received on Tue Jul 5 05:40:57 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.