Changes to allow DATETIME values to be negated, for the purposes of reverse

sorting.
This commit is contained in:
John Wiegley 2008-07-17 22:23:14 -04:00
parent 3d1ab0e4e7
commit 41e8d1871e
2 changed files with 5 additions and 4 deletions

View file

@ -19,9 +19,6 @@ class date_t
{ {
date_t(const datetime_t& _when); date_t(const datetime_t& _when);
protected:
std::time_t when;
public: public:
static date_t now; static date_t now;
static const char * formats[]; static const char * formats[];
@ -29,6 +26,8 @@ class date_t
static std::string input_format; static std::string input_format;
static std::string output_format; static std::string output_format;
std::time_t when;
date_t() : when(0) {} date_t() : when(0) {}
date_t(const date_t& _when) : when(_when.when) {} date_t(const date_t& _when) : when(_when.when) {}

View file

@ -1067,7 +1067,9 @@ void value_t::negate()
*((long *) data) = - *((long *) data); *((long *) data) = - *((long *) data);
break; break;
case DATETIME: case DATETIME:
throw new value_error("Cannot negate a date/time"); cast(INTEGER);
negate();
break;
case AMOUNT: case AMOUNT:
((amount_t *) data)->negate(); ((amount_t *) data)->negate();
break; break;