daily pastebin goal
67%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/mythtv/libs/libmythservicecontracts/service.cpp b/mythtv/libs/libmythservicecontracts/service.cpp
  2. index d20fc01..fd1451c 100644
  3. --- a/mythtv/libs/libmythservicecontracts/service.cpp
  4. +++ b/mythtv/libs/libmythservicecontracts/service.cpp
  5. @@ -84,7 +84,13 @@ void* Service::ConvertToParameterPtr( int            nTypeId,
  6.          case QMetaType::QString     : *(( QString        *)pParam) = sValue;                break;
  7.          case QMetaType::QByteArray  : *(( QByteArray     *)pParam) = sValue.toUtf8      (); break;
  8.  
  9. -        case QMetaType::QDateTime   : *(( QDateTime      *)pParam) = QDateTime::fromString( sValue, Qt::ISODate ); break;
  10. +        case QMetaType::QDateTime   :
  11. +        {
  12. +            QDateTime dt = QDateTime::fromString( sValue, Qt::ISODate );
  13. +            dt.setTimeSpec(Qt::UTC);
  14. +            *(( QDateTime      *)pParam) = dt.toLocalTime();
  15. +            break;
  16. +        }
  17.          case QMetaType::QTime       : *(( QTime          *)pParam) = QTime::fromString    ( sValue, Qt::ISODate ); break;
  18.          case QMetaType::QDate       : *(( QDate          *)pParam) = QDate::fromString    ( sValue, Qt::ISODate ); break;
  19.      }
  20. diff --git a/mythtv/libs/libmythupnp/serializers/jsonSerializer.cpp b/mythtv/libs/libmythupnp/serializers/jsonSerializer.cpp
  21. index 5d61ead..e67af64 100644
  22. --- a/mythtv/libs/libmythupnp/serializers/jsonSerializer.cpp
  23. +++ b/mythtv/libs/libmythupnp/serializers/jsonSerializer.cpp
  24. @@ -25,6 +25,7 @@
  25.  
  26.  #include <QTextCodec>
  27.  #include <QVariant>
  28. +#include <QDateTime>
  29.  
  30.  //////////////////////////////////////////////////////////////////////////////
  31.  //
  32. @@ -155,6 +156,12 @@ void JSONSerializer::RenderValue( const QVariant &vValue )
  33.          case QVariant::List:        RenderList      ( vValue.toList()       );  break;
  34.          case QVariant::StringList:  RenderStringList( vValue.toStringList() );  break;
  35.          case QVariant::Map:         RenderMap       ( vValue.toMap()        );  break;
  36. +        case QVariant::DateTime:
  37. +        {
  38. +            m_Stream << "\"" << Encode( vValue.toDateTime().toUTC()
  39. +                     .toString(Qt::ISODate) ) << "\"";
  40. +            break;
  41. +        }
  42.          default:
  43.          {
  44.              m_Stream << "\"" << Encode( vValue.toString() ) << "\"";
  45. diff --git a/mythtv/libs/libmythupnp/serializers/xmlSerializer.cpp b/mythtv/libs/libmythupnp/serializers/xmlSerializer.cpp
  46. index 8db05c6..269b4c7 100644
  47. --- a/mythtv/libs/libmythupnp/serializers/xmlSerializer.cpp
  48. +++ b/mythtv/libs/libmythupnp/serializers/xmlSerializer.cpp
  49. @@ -24,6 +24,7 @@
  50.  #include "xmlSerializer.h"
  51.  
  52.  #include <QMetaClassInfo>
  53. +#include <QDateTime>
  54.  
  55.  // --------------------------------------------------------------------------
  56.  // This version should be bumped if the serializer code is changed in a way
  57. @@ -176,6 +177,13 @@ void XmlSerializer::RenderValue( const QString &sName, const QVariant &vValue )
  58.              break;
  59.          }
  60.  
  61. +        case QVariant::DateTime:
  62. +        {
  63. +            m_pXmlWriter->writeCharacters( vValue.toDateTime().toUTC()
  64. +                                               .toString(Qt::ISODate) );
  65. +            break;
  66. +        }
  67. +
  68.          default:
  69.          {
  70.              m_pXmlWriter->writeCharacters( vValue.toString() );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top