示例#1
0
文件: encoder.cpp 项目: FLMao/SFrame
static void _to_serializable(flexible_type& data, schema_t& schema, const flex_date_time& input) {
  schema.insert(std::make_pair("type", JSON::types::DATETIME));
  flex_dict ret;

  int32_t time_zone_offset = input.time_zone_offset();
  ret.push_back(std::make_pair("posix_timestamp", input.posix_timestamp()));
  ret.push_back(std::make_pair("tz_15_min_offset",
    time_zone_offset == 64 ? FLEX_UNDEFINED : flexible_type(flex_int(time_zone_offset))));
  ret.push_back(std::make_pair("microsecond", input.microsecond()));

  data = ret;
}
 /// Equality comparator, timezone is checked
 inline bool identical(const flex_date_time& other) const{
   return posix_timestamp() == other.posix_timestamp() && 
       time_zone_offset() == other.time_zone_offset() &&
       microsecond() == other.microsecond();
 }