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

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/cmd-inet/sbin/dhcpagent/init_reboot.c
          +++ new/usr/src/cmd/cmd-inet/sbin/dhcpagent/init_reboot.c
↓ open down ↓ 229 lines elided ↑ open up ↑
 230  230   *          unsigned int: the number of REQUESTs sent so far
 231  231   *  output: boolean_t: B_TRUE if retransmissions should stop
 232  232   */
 233  233  
 234  234  static boolean_t
 235  235  stop_init_reboot(dhcp_smach_t *dsmp, unsigned int n_requests)
 236  236  {
 237  237          if (dsmp->dsm_isv6) {
 238  238                  uint_t nowabs, maxabs;
 239  239  
 240      -                nowabs = gethrtime() / (NANOSEC / MILLISEC);
 241      -                maxabs = dsmp->dsm_neg_hrtime / (NANOSEC / MILLISEC) +
 242      -                    DHCPV6_CNF_MAX_RD;
      240 +                nowabs = NSEC2MSEC(gethrtime());
      241 +                maxabs = NSEC2MSEC(dsmp->dsm_neg_hrtime) + DHCPV6_CNF_MAX_RD;
 243  242                  if (nowabs < maxabs) {
 244  243                          /* Cap the timer based on the maximum */
 245  244                          if (nowabs + dsmp->dsm_send_timeout > maxabs)
 246  245                                  dsmp->dsm_send_timeout = maxabs - nowabs;
 247  246                          return (B_FALSE);
 248  247                  }
 249  248          } else {
 250  249                  if (n_requests < DHCP_MAX_REQUESTS)
 251  250                          return (B_FALSE);
 252  251          }
↓ open down ↓ 39 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX