Skip to content

Commit

Permalink
Merge pull request #165 from dzek69/dateTimeFix
Browse files Browse the repository at this point in the history
Fix for cameras without UTCDateTime
  • Loading branch information
chriswiggins committed Nov 5, 2020
2 parents 9686c0e + 2ccbd70 commit 2cdafa0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/cam.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,9 @@ Cam.prototype.getSystemDateAndTime = function(callback) {
}, function(err, data, xml) {
if (!err) {
try {
var dt = linerase(data[0]['getSystemDateAndTimeResponse'][0]['systemDateAndTime'][0]['UTCDateTime'][0])
var systemDateAndTime = data[0]['getSystemDateAndTimeResponse'][0]['systemDateAndTime'][0];
var dateTime = systemDateAndTime['UTCDateTime'] || systemDateAndTime['localDateTime'];
var dt = linerase(dateTime[0])
, time = new Date(Date.UTC(dt.date.year, dt.date.month - 1, dt.date.day, dt.time.hour, dt.time.minute, dt.time.second))
;
if (!this.timeShift) {
Expand Down

0 comments on commit 2cdafa0

Please sign in to comment.