make EqualsNoTime actually work for not-structs...

Change-Id: Ieb0f4d9904fb4d01a6603bf2ad33e16b66ad2a42
diff --git a/aos/build/queues/output/message_dec.rb b/aos/build/queues/output/message_dec.rb
index 6290489..781d5b3 100644
--- a/aos/build/queues/output/message_dec.rb
+++ b/aos/build/queues/output/message_dec.rb
@@ -115,6 +115,10 @@
     @members.each do |elem|
       if elem.respond_to? :create_EqualsNoTime
         member_func.suite << "if (!other.#{elem.name}.EqualsNoTime(#{elem.name})) return false;"
+      elsif elem.respond_to?(:length) && elem.member_type.respond_to?(:create_EqualsNoTime)
+        0.upto(elem.length - 1) do |i|
+          member_func.suite << "if (!other.#{elem.name}[#{i}].EqualsNoTime(#{elem.name}[#{i}])) return false;"
+        end
       else
         member_func.suite << "if (other.#{elem.name} != #{elem.name}) return false;"
       end
@@ -228,6 +232,7 @@
     create_DoGetType(type_class, cpp_tree)
     create_DefaultConstructor(type_class, cpp_tree)
     create_InOrderConstructor(type_class, cpp_tree)
+    create_EqualsNoTime(type_class, cpp_tree)
 
     b_namespace = cpp_tree.get(b_loc = self.class.builder_loc(@loc))
 
@@ -367,6 +372,9 @@
   def type()
     return "::std::array< #{@type.type()}, #{@length}>"
   end
+  def member_type()
+    return @type
+  end
   def simpleStr()
     return "#{@type.type} #{@name}[#{@length}]"
   end
diff --git a/aos/build/queues/output/q_struct.rb b/aos/build/queues/output/q_struct.rb
index 8e2e811..4c02ecd 100644
--- a/aos/build/queues/output/q_struct.rb
+++ b/aos/build/queues/output/q_struct.rb
@@ -85,8 +85,11 @@
     @members.each do |elem|
       if elem.respond_to? :create_EqualsNoTime
         member_func.suite << "if (!other.#{elem.name}.EqualsNoTime(#{elem.name})) return false;"
+      elsif elem.respond_to?(:length) && elem.member_type.respond_to?(:create_EqualsNoTime)
+        0.upto(elem.length - 1) do |i|
+          member_func.suite << "if (!other.#{elem.name}[#{i}].EqualsNoTime(#{elem.name}[#{i}])) return false;"
+        end
       else
-        puts elem.class.to_s + ' ' + elem.name.to_s
         member_func.suite << "if (other.#{elem.name} != #{elem.name}) return false;"
       end
     end
diff --git a/aos/common/queue_test.cc b/aos/common/queue_test.cc
index 124fa0e..6d5dda6 100644
--- a/aos/common/queue_test.cc
+++ b/aos/common/queue_test.cc
@@ -273,6 +273,21 @@
   EXPECT_LE(msg.sent_time - Time::Now(), Time::InMS(20));
 }
 
+// Tests that EqualsNoTime works.
+TEST_F(MessageTest, EqualsNoTime) {
+  msg.test_bool = true;
+  msg.test_int = 971;
+  TestingMessage other;
+  other.test_int = 971;
+  EXPECT_FALSE(other.EqualsNoTime(msg));
+  EXPECT_FALSE(msg.EqualsNoTime(other));
+  other.test_bool = true;
+  EXPECT_TRUE(other.EqualsNoTime(msg));
+  EXPECT_TRUE(msg.EqualsNoTime(other));
+  msg.SetTimeToNow();
+  EXPECT_TRUE(msg.EqualsNoTime(other));
+}
+
 }  // namespace testing
 }  // namespace common
 }  // namespace aos