From ed481ec3f1fa252c9a72dfda631e7bfddde8cfad Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Tue, 23 Apr 2024 15:47:26 -0400 Subject: [PATCH] 2024-04-24 Fred Gleason * Fixed a regression in the PyPAD subsystem that broke null datetime handling. Signed-off-by: Fred Gleason --- ChangeLog | 3 +++ apis/pypad/api/pypad.py | 2 ++ lib/rdlogplay.cpp | 10 ++++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 562859e22..95c57b57b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24709,3 +24709,6 @@ * Added a 'tempdir_test' test harness. 2024-04-22 Fred Gleason * Added an 'Ubuntu 24.04 LTS' section to 'INSTALL'. +2024-04-24 Fred Gleason + * Fixed a regression in the PyPAD subsystem that broke null datetime + handling. diff --git a/apis/pypad/api/pypad.py b/apis/pypad/api/pypad.py index e942ee58e..2cad84129 100644 --- a/apis/pypad/api/pypad.py +++ b/apis/pypad/api/pypad.py @@ -90,6 +90,8 @@ def __init__(self,pad_data,config,rd_config): def __fromIso8601(self,string): try: + if len(string)==0: + return datetime.datetime() return datetime.datetime.strptime(string.strip()[:19],'%Y-%m-%dT%H:%M:%S') except AttributeError: return '' diff --git a/lib/rdlogplay.cpp b/lib/rdlogplay.cpp index 3c74a094f..dd6540c0b 100644 --- a/lib/rdlogplay.cpp +++ b/lib/rdlogplay.cpp @@ -20,6 +20,7 @@ #include "rdapplication.h" #include "rdconf.h" +#include "rddatetime.h" #include "rddb.h" #include "rddebug.h" #include "rdescape_string.h" @@ -3186,7 +3187,7 @@ void RDLogPlay::SendNowNext() // Header Fields // QJsonObject jo0; - jo0.insert("dateTime",QDateTime::currentDateTime().toString(Qt::ISODate)); + jo0.insert("dateTime",RDWriteXmlDateTime(QDateTime::currentDateTime())); jo0.insert("hostName",rda->station()->name()); jo0.insert("shortHostName",rda->station()->shortName()); jo0.insert("machine",1+play_id); @@ -3332,7 +3333,12 @@ QJsonValue RDLogPlay::GetPadJson(const QString &name,RDLogLine *ll, return QJsonValue(); } - jo0.insert("startDateTime",start_datetime.toString(Qt::ISODate)); + if(start_datetime.isNull()) { + jo0.insert("startDateTime",QJsonValue()); + } + else { + jo0.insert("startDateTime",RDWriteXmlDateTime(start_datetime)); + } jo0.insert("lineNumber",line); jo0.insert("lineId",ll->id()); jo0.insert("eventType",RDLogLine::typeText(ll->type()));