Print this page
4823 don't open-code NSEC2MSEC and MSEC2NSEC

@@ -1496,11 +1496,11 @@
                 tsp = (uint32_t *)&icmph[1];
                 tsp++;          /* Skip past 'originate time' */
                 /* Compute # of milliseconds since midnight */
                 gethrestime(&now);
                 ts = (now.tv_sec % (24 * 60 * 60)) * 1000 +
-                    now.tv_nsec / (NANOSEC / MILLISEC);
+                    NSEC2MSEC(now.tv_nsec);
                 *tsp++ = htonl(ts);     /* Lay in 'receive time' */
                 *tsp++ = htonl(ts);     /* Lay in 'send time' */
                 BUMP_MIB(&ipst->ips_icmp_mib, icmpOutTimestampReps);
                 icmp_send_reply_v4(mp, ipha, icmph, ira);
                 return (NULL);

@@ -9115,11 +9115,11 @@
                         case IPOPT_TS_TSONLY:
                                 off = opt[IPOPT_OFFSET] - 1;
                                 /* Compute # of milliseconds since midnight */
                                 gethrestime(&now);
                                 ts = (now.tv_sec % (24 * 60 * 60)) * 1000 +
-                                    now.tv_nsec / (NANOSEC / MILLISEC);
+                                    NSEC2MSEC(now.tv_nsec);
                                 bcopy(&ts, (char *)opt + off, IPOPT_TS_TIMELEN);
                                 opt[IPOPT_OFFSET] += IPOPT_TS_TIMELEN;
                                 break;
                         }
                         break;

@@ -9341,11 +9341,11 @@
                         case IPOPT_TS_TSONLY:
                                 off = opt[IPOPT_OFFSET] - 1;
                                 /* Compute # of milliseconds since midnight */
                                 gethrestime(&now);
                                 ts = (now.tv_sec % (24 * 60 * 60)) * 1000 +
-                                    now.tv_nsec / (NANOSEC / MILLISEC);
+                                    NSEC2MSEC(now.tv_nsec);
                                 bcopy(&ts, (char *)opt + off, IPOPT_TS_TIMELEN);
                                 opt[IPOPT_OFFSET] += IPOPT_TS_TIMELEN;
                                 break;
                         }
                         break;

@@ -12023,11 +12023,11 @@
                         case IPOPT_TS_TSONLY:
                                 off = opt[IPOPT_OFFSET] - 1;
                                 /* Compute # of milliseconds since midnight */
                                 gethrestime(&now);
                                 ts = (now.tv_sec % (24 * 60 * 60)) * 1000 +
-                                    now.tv_nsec / (NANOSEC / MILLISEC);
+                                    NSEC2MSEC(now.tv_nsec);
                                 bcopy(&ts, (char *)opt + off, IPOPT_TS_TIMELEN);
                                 opt[IPOPT_OFFSET] += IPOPT_TS_TIMELEN;
                                 break;
                         }
                         break;