wangchdo commented on code in PR #17689:
URL: https://github.com/apache/nuttx/pull/17689#discussion_r2647869637
##########
net/icmp/icmp_input.c:
##########
@@ -246,6 +246,39 @@ static bool icmp_deliver(FAR struct net_driver_s *dev,
uint16_t iphdrlen)
}
#endif
+/****************************************************************************
+ * Name: icmp_timestamp
+ *
+ * Description:
+ * Return milliseconds since midnight.
+ *
+ ****************************************************************************/
+
+static uint32_t icmp_timestamp(void)
+{
+ struct timespec ts;
+ uint32_t secs;
+ uint32_t msecs;
+
+ nxclock_gettime(CLOCK_REALTIME, &ts);
+
+ /* Get secs since midnight. */
+
+ secs = ts.tv_sec % 86400;
+
+ /* Convert to msecs. */
+
+ msecs = secs * 1000;
+
+ /* Convert nsec to msec. */
+
+ msecs += ts.tv_nsec / 1000000;
Review Comment:
Suggest to use `NSEC_PER_MSEC`
##########
net/icmp/icmp_input.c:
##########
@@ -246,6 +246,39 @@ static bool icmp_deliver(FAR struct net_driver_s *dev,
uint16_t iphdrlen)
}
#endif
+/****************************************************************************
+ * Name: icmp_timestamp
+ *
+ * Description:
+ * Return milliseconds since midnight.
+ *
+ ****************************************************************************/
+
+static uint32_t icmp_timestamp(void)
+{
+ struct timespec ts;
+ uint32_t secs;
+ uint32_t msecs;
+
+ nxclock_gettime(CLOCK_REALTIME, &ts);
+
+ /* Get secs since midnight. */
+
+ secs = ts.tv_sec % 86400;
+
+ /* Convert to msecs. */
+
+ msecs = secs * 1000;
Review Comment:
Suggest to use `MSEC_PER_SEC`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]