   }
   if (res != sizeof(reply) + sizeof(IPRAW_HEADER)) goto error;
   res = sock->recv(&reply, sizeof(reply), src, port);
-  roundtrip = RTC::millis();
+  roundtrip = RTC::micros();
 
   // Sanity check the reply; right size, checksum, id
   if (res != sizeof(reply)) goto error;
   if (reply.type != ICMP_ECHOREPLY) goto error;
+  if (req.echo.id != 0xC05A) goto error;
+  if (req.echo.seq != seq) goto error;
   if (INET::checksum(&reply, sizeof(reply)) != 0) goto error;
-  if (req.echo.id != 0xC05A) goto error;
 
   // Calculate the time for the ping roundtrip
-  roundtrip -= reply.echo.seq;
-  INFO("roundtrip=%ud ms", roundtrip);
+  roundtrip -= reply.timestamp;
+  INFO("Roundtrip: %ul us", roundtrip);
 
  error:
   sock->close();


  INFO("Build ICMP echo request block", 0);
  icmphdr req;
  req.type = ICMP_ECHO;
  req.code = 0;
  req.checksum = 0;
  req.echo.id = 0xC05A;
  for (uint8_t i = 0; i < sizeof(req.payload); i++)
    req.payload[i] = i;
  req.echo.seq = RTC::millis();
  req.checksum = hton(INET::checksum(&req, sizeof(req)));
  ASSERT(INET::checksum(&req, sizeof(req)) == 0);


  if (res < 0) goto error;

  INFO("Receive the reply", 0);
  uint32_t roundtrip;
  icmphdr reply;
  uint8_t src[4];
  uint16_t port;
