~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/temporal.cc

this was the first working build, and these changes make almost all the tests pass

removed unnecessary tests
added [init/deinit]_temporal_formats calls in tests
bug fixes in tests
call set_epoch_seconds in generators

disabled tests where the API needs calrification

fixed Timestamp and Date > and >= operators
fixed Time::from_int32_t
changed comment in temporal.h to reflact actual way code is working

Show diffs side-by-side

added added

removed removed

Lines of Context:
1020
1020
}
1021
1021
bool Date::operator>(const Timestamp& rhs)
1022
1022
{
1023
 
  return ! (*this < rhs);
 
1023
  return ! (*this <= rhs);
1024
1024
}
1025
1025
bool Date::operator>=(const Timestamp& rhs)
1026
1026
{
1027
 
  return ! (*this <= rhs);
 
1027
  return ! (*this < rhs);
1028
1028
}
1029
1029
/*
1030
1030
 * Comparison operators between a Timestamp and a Date
1057
1057
}
1058
1058
bool Timestamp::operator>(const Date& rhs)
1059
1059
{
1060
 
  return ! (*this < rhs);
 
1060
  return ! (*this <= rhs);
1061
1061
}
1062
1062
bool Timestamp::operator>=(const Date& rhs)
1063
1063
{
1064
 
  return ! (*this <= rhs);
 
1064
  return ! (*this < rhs);
1065
1065
}
1066
1066
/*
1067
1067
 * Comparison operators between a Timestamp and a DateTime
1110
1110
}
1111
1111
bool Timestamp::operator>(const DateTime& rhs)
1112
1112
{
1113
 
  return ! (*this < rhs);
 
1113
  return ! (*this <= rhs);
1114
1114
}
1115
1115
bool Timestamp::operator>=(const DateTime& rhs)
1116
1116
{
1117
 
  return ! (*this <= rhs);
 
1117
  return ! (*this < rhs);
1118
1118
}
1119
1119
/*
1120
1120
 * Comparison operators between two Timestamps
1137
1137
}
1138
1138
bool Timestamp::operator>(const Timestamp& rhs)
1139
1139
{
1140
 
  return ! (*this < rhs);
 
1140
  return ! (*this <= rhs);
1141
1141
}
1142
1142
bool Timestamp::operator>=(const Timestamp& rhs)
1143
1143
{
1144
 
  return ! (*this <= rhs);
 
1144
  return ! (*this < rhs);
1145
1145
}
1146
1146
 
1147
1147
/**
1342
1342
bool Time::from_int32_t(const int32_t from)
1343
1343
{
1344
1344
  uint32_t copy_from= (uint32_t) from;
1345
 
  _hours= copy_from % INT32_C(10000);
1346
 
  _minutes= copy_from % INT32_C(100);
1347
 
  _seconds= copy_from & 3; /* Masks off all but last 2 digits */
 
1345
  _hours= copy_from / INT32_C(10000);
 
1346
  _minutes= (copy_from % INT32_C(10000)) / INT32_C(100);
 
1347
  _seconds= copy_from % INT32_C(100); /* Masks off all but last 2 digits */
1348
1348
  return is_valid();
1349
1349
}
1350
1350