Ticket #9379: ticket9379.patch

File ticket9379.patch, 2.2 KB (added by brian.groose@…, 5 years ago)

Patch for tocket 9379

  • boost/chrono/config.hpp

    diff --git a/boost/chrono/config.hpp b/boost/chrono/config.hpp
    index 1045ba3a..84eed72c 100644
    a b  
    8484#   include <time.h>  //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME
    8585#   if defined(CLOCK_MONOTONIC)
    8686#      define BOOST_CHRONO_HAS_CLOCK_STEADY
     87#   elif defined(__GNUC__) && defined(__hpux)
     88#      define BOOST_CHRONO_HAS_GETHRTIME
     89#      define BOOST_CHRONO_HAS_CLOCK_STEADY
    8790#   endif
    8891#   if defined(_POSIX_THREAD_CPUTIME) && !defined(BOOST_DISABLE_THREADS)
    8992#     define BOOST_CHRONO_HAS_THREAD_CLOCK
  • boost/chrono/detail/inlined/posix/chrono.hpp

    diff --git a/boost/chrono/detail/inlined/posix/chrono.hpp b/boost/chrono/detail/inlined/posix/chrono.hpp
    index c4c8a6ad..4046d0e1 100644
    a b namespace chrono  
    7474
    7575  steady_clock::time_point steady_clock::now() BOOST_NOEXCEPT
    7676  {
     77#ifdef BOOST_CHRONO_HAS_GETHRTIME
     78    hrtime_t hrt = gethrtime();
     79    BOOST_ASSERT(hrt >= 0);
     80    return time_point(nanoseconds(hrt));
     81#else
    7782    timespec ts;
    7883    if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
    7984    {
    namespace chrono  
    8287
    8388    return time_point(duration(
    8489      static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
     90#endif
    8591  }
    8692
    8793#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
    8894  steady_clock::time_point steady_clock::now(system::error_code & ec)
    8995  {
     96#ifdef BOOST_CHRONO_HAS_GETHRTIME
     97    hrtime_t hrt = gethrtime();
     98    if (hrt < 0)
     99    {
     100        boost::throw_exception(
     101                system::system_error(
     102                        EFAULT,
     103                        BOOST_CHRONO_SYSTEM_CATEGORY,
     104                        "chrono::steady_clock" ));
     105    }
     106    else
     107    {
     108        ec.assign( EFAULT, BOOST_CHRONO_SYSTEM_CATEGORY );
     109        return time_point();
     110    }
     111    if (!BOOST_CHRONO_IS_THROWS(ec))
     112    {
     113        ec.clear();
     114    }
     115    return time_point(nanoseconds(hrt));
     116#else
    90117    timespec ts;
    91118    if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
    92119    {
    namespace chrono  
    111138    }
    112139    return time_point(duration(
    113140      static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
     141#endif
    114142  }
    115143#endif
    116144#endif