Skip to content

Commit

Permalink
2024-04-24 Fred Gleason <[email protected]>
Browse files Browse the repository at this point in the history
	* Fixed a regression in the PyPAD subsystem that broke null datetime
	handling.

Signed-off-by: Fred Gleason <[email protected]>
  • Loading branch information
ElvishArtisan committed Apr 23, 2024
1 parent 8e08dad commit ed481ec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -24709,3 +24709,6 @@
* Added a 'tempdir_test' test harness.
2024-04-22 Fred Gleason <[email protected]>
* Added an 'Ubuntu 24.04 LTS' section to 'INSTALL'.
2024-04-24 Fred Gleason <[email protected]>
* Fixed a regression in the PyPAD subsystem that broke null datetime
handling.
2 changes: 2 additions & 0 deletions apis/pypad/api/pypad.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''
Expand Down
10 changes: 8 additions & 2 deletions lib/rdlogplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "rdapplication.h"
#include "rdconf.h"
#include "rddatetime.h"
#include "rddb.h"
#include "rddebug.h"
#include "rdescape_string.h"
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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()));
Expand Down

0 comments on commit ed481ec

Please sign in to comment.