Ticket #2956: boost_1_38_0.date_time.vxworks.patch

File boost_1_38_0.date_time.vxworks.patch, 3.0 KB (added by Dustin Spicuzza <dustin@…>, 14 years ago)
  • boost/date_time/c_time.hpp

    diff -r -u boost_1_38_0/boost/date_time/c_time.hpp boost_1_38_vxworks/boost/date_time/c_time.hpp
    old new  
    5555      static std::tm* localtime(const std::time_t* t, std::tm* result)
    5656      {
    5757        // localtime_r() not in namespace std???
    58         result = localtime_r(t, result);
     58#if !defined(BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS_NO_RETVAL)
     59        result =
     60#endif
     61                localtime_r(t, result);
    5962        if (!result)
    6063          boost::throw_exception(std::runtime_error("could not convert calendar time to local time"));
    6164        return result;
     
    6568      static std::tm* gmtime(const std::time_t* t, std::tm* result)
    6669      {
    6770        // gmtime_r() not in namespace std???
    68         result = gmtime_r(t, result);
     71#if !defined(BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS_NO_RETVAL)
     72        result =
     73#endif
     74        gmtime_r(t, result);
    6975        if (!result)
    7076          boost::throw_exception(std::runtime_error("could not convert calendar time to UTC time"));
    7177        return result;
  • boost/date_time/compiler_config.hpp

    diff -r -u boost_1_38_0/boost/date_time/compiler_config.hpp boost_1_38_vxworks/boost/date_time/compiler_config.hpp
    old new  
    3232
    3333//Set up a configuration parameter for platforms that have
    3434//GetTimeOfDay
    35 #if defined(BOOST_HAS_GETTIMEOFDAY) || defined(BOOST_HAS_FTIME)
     35#if defined(BOOST_HAS_GETTIMEOFDAY) || defined(BOOST_HAS_FTIME) || defined(BOOST_HAS_CLOCK_GETTIME)
    3636#define BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK
    3737#endif
    3838
     
    164164     //no reentrant posix functions (eg: localtime_r)
    165165#  elif (!defined(__hpux) || (defined(__hpux) && defined(_REENTRANT)))
    166166#   define BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS
     167#   if defined(__VXWORKS__)
     168      // vxworks has strange versions of localtime_r and gmtime_r
     169#     define BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS_NO_RETVAL
     170#   endif
    167171#  endif
    168172#endif
    169173
  • boost/date_time/microsec_time_clock.hpp

    diff -r -u boost_1_38_0/boost/date_time/microsec_time_clock.hpp boost_1_38_vxworks/boost/date_time/microsec_time_clock.hpp
    old new  
    8484      gettimeofday(&tv, 0); //gettimeofday does not support TZ adjust on Linux.
    8585      std::time_t t = tv.tv_sec;
    8686      boost::uint32_t sub_sec = tv.tv_usec;
     87#elif defined(BOOST_HAS_CLOCK_GETTIME)
     88      timespec ts;
     89      clock_gettime(CLOCK_REALTIME, &ts);
     90      std::time_t t = ts.tv_sec;
     91      boost::uint32_t sub_sec = ts.tv_nsec/1000;
    8792#elif defined(BOOST_HAS_FTIME)
    8893      winapi::file_time ft;
    8994      winapi::get_system_time_as_file_time(ft);