Permalink
Browse files

Convert some the code in [d4f718c] Myth Services UTC commit, to use M…

…ythDate utility functions.

Note the code as is will work so there is no need to update immediately if you are working with the services API.
  • Loading branch information...
1 parent 4c37533 commit f2dd6f9e90cd672cf47a9d364a68f98a2d258b13 @daniel-kristjansson daniel-kristjansson committed Jun 21, 2012
@@ -11,6 +11,7 @@
//////////////////////////////////////////////////////////////////////////////
#include "service.h"
+#include "mythdate.h"
//////////////////////////////////////////////////////////////////////////////
//
@@ -75,9 +76,7 @@ void* Service::ConvertToParameterPtr( int nTypeId,
case QMetaType::QDateTime :
{
- QDateTime dt = QDateTime::fromString( sValue, Qt::ISODate );
- dt.setTimeSpec(Qt::UTC);
- *(( QDateTime *)pParam) = dt.toLocalTime();
+ *(( QDateTime *)pParam) = MythDate::fromString( sValue );
break;
}
case QMetaType::QTime : *(( QTime *)pParam) = QTime::fromString ( sValue, Qt::ISODate ); break;
@@ -11,10 +11,10 @@
//////////////////////////////////////////////////////////////////////////////
#include "jsonSerializer.h"
+#include "mythdate.h"
#include <QTextCodec>
#include <QVariant>
-#include <QDateTime>
//////////////////////////////////////////////////////////////////////////////
//
@@ -147,8 +147,9 @@ void JSONSerializer::RenderValue( const QVariant &vValue )
case QVariant::Map: RenderMap ( vValue.toMap() ); break;
case QVariant::DateTime:
{
- m_Stream << "\"" << Encode( vValue.toDateTime().toUTC()
- .toString(Qt::ISODate) ) << "\"";
+ m_Stream << "\"" << Encode(
+ MythDate::toString( vValue.toDateTime(), MythDate::ISODate ) )
+ << "\"";
break;
}
default:
@@ -11,9 +11,9 @@
//////////////////////////////////////////////////////////////////////////////
#include "xmlSerializer.h"
+#include "mythdate.h"
#include <QMetaClassInfo>
-#include <QDateTime>
// --------------------------------------------------------------------------
// This version should be bumped if the serializer code is changed in a way
@@ -173,7 +173,9 @@ void XmlSerializer::RenderValue( const QString &sName, const QVariant &vValue )
if (dt.isNull())
m_pXmlWriter->writeAttribute( "xsi:nil", "true" );
- m_pXmlWriter->writeCharacters( dt.toUTC().toString(Qt::ISODate) );
+ m_pXmlWriter->writeCharacters(
+ MythDate::toString( dt, MythDate::ISODate ) );
+
break;
}
@@ -333,4 +335,4 @@ QString XmlSerializer::FindOptionValue( const QStringList &sOptions, const QStri
}
return QString();
-}
+}

0 comments on commit f2dd6f9

Please sign in to comment.