sec = date->sec;
}
-bool Date::before(Date date2) {
+bool Date::before(Date *date2) {
bool ret_val;
+ string s1;
+ string s2;
- string s1 = this->to_sortable_string();
- string s2 = date2.to_sortable_string();
ret_val = false;
- if (s1.compare(s2) < 0) {
- ret_val = true;
+ if (date2 != NULL) {
+ s1 = this->to_sortable_string();
+ s2 = date2->to_sortable_string();
+ if (s1.compare(s2) < 0) {
+ ret_val = true;
+ }
}
return ret_val;
}
-bool Date::equals(Date date2) {
+bool Date::equals(Date *date2) {
bool ret_val;
ret_val = false;
- if ((this->sec == date2.sec) &&
- (this->min == date2.min) &&
- (this->hour == date2.hour) &&
- (this->day == date2.day) &&
- (this->month == date2.month) &&
- (this->year == date2.year)) {
- ret_val = true;
+ if (date2 != NULL) {
+ if ((this->sec == date2->sec) &&
+ (this->min == date2->min) &&
+ (this->hour == date2->hour) &&
+ (this->day == date2->day) &&
+ (this->month == date2->month) &&
+ (this->year == date2->year)) {
+ ret_val = true;
+ }
}
return ret_val;
}