lmi
[Top][All Lists]
Advanced

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

Re: [lmi] wx_test_expiry_dates.cpp


From: Vadim Zeitlin
Subject: Re: [lmi] wx_test_expiry_dates.cpp
Date: Mon, 15 Dec 2014 16:46:10 +0100

On Mon, 15 Dec 2014 15:05:18 +0000 Greg Chicares <address@hidden> wrote:

GC> > 2. I used wxDateTime for parsing the YYYYMMDD string passed on the command
GC> >    line because doing it with istream is just too painful
[...]
GC> Could you simply adapt this example from 'calendar_date_test.cpp'?
GC> 
GC>     // Construct from ymd_t.
GC>     calendar_date date4(ymd_t(18991231));
GC>     BOOST_TEST_EQUAL(dublin_epoch, date4);
GC> 
GC> An istream can read "18991231" as the integer 18,991,231 , which is
GC> then converted via 'ymd_t'.

 I was reluctant to do it like this because it doesn't check for the exact
format ("%04d%02d%02d") and so would "work" on strings like "141215" which
could have been expected to mean "20141215" but, of course, don't. OTOH I'm
probably overcomplicating things as usual and lmi users and especially
testers are probably familiar with ISO 8601 format considering that it's
already used in other places, so I've finally overcome this reluctance to
produce the attached patch.

 I've tested it and it results in the expected, albeit not always very
precise, errors if an invalid date is specified.

VZ

Attachment: 0001-Do-not-use-wxDateTime-for-parsing-dates-in-ISO-8601-.patch
Description: Text document


reply via email to

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