bug-commoncpp
[Top][All Lists]
Advanced

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

commconcpp2 changes to date.cpp (copy)


From: Chad Yates
Subject: commconcpp2 changes to date.cpp (copy)
Date: Tue, 07 Jan 2003 12:25:31 -0800

I just started recieving list messages again today.  It appears that my
previous messages were lost, so I'm forwarding them again...

The recent changes to date.cpp broke the library under MSVC 6.0 on the
following:

  nyear = int(trunc(i));
  nmonth = int(trunc(j));
  nday = int(trunc(k));

I removed the trunc() function, and wondered if it was redundant anyway?
since the int() should suffice.

I also wrote a test suite for the date class (figured what better way to
determine if trunc() was necessary, and it needed to be done anyway) The
following are the test cases, and I'll save the code fore release with the
test suite:

  DateTest.testSimpleGets ...
  DateTest.testSimpleSets ...
  DateTest.testIsValid ...
  DateTest.testGetDate_String ...
  DateTest.testGetDate_time_t ...
  DateTest.testGeteDate_struct_tm ...
  DateTest.testOperations ...

and implemented a functions that were defined in the class but not
implemented (linker errors).  I also re-arranged some of the related methods
to avoid duplicate code.  I've attached diffs showing what was changed. here
is a summary:

date.cpp
- added test fixture for the Date class and fixed/enhanced.
- implemented missing tm* Date::getDate(tm*) function declared in
  class but not in implementation. took the liberty to make it
  also return a time_t instead of tm* in addition to filling the
  provided tm structure.
- simplified time_t Date::getDate(void) to use the above function.
- changed setDate parameter to const and placed (char*) in calls to Number.
setDate's use of Number seems to guarantee constness, but I don't know if
Number itself does. hopefully these casts can be removed someday.

email me with questions and comments.

,Chad

Attachment: date_cpp.diff
Description: Binary data

Attachment: numbers_h.diff
Description: Binary data


reply via email to

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