agsh / onvif

ONVIF node.js implementation
http://agsh.github.io/onvif/
MIT License
693 stars 236 forks source link

Fix for cameras without UTCDateTime #165

Closed dzek69 closed 3 years ago

dzek69 commented 4 years ago

Fixes #160, tested on real device that has this issue

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.03%) to 87.872% when pulling 2ccbd7076278cc955aca0a2e84642fb99d76f0f1 on dzek69:dateTimeFix into e2ab59ea3659ae73dbaa69e3a36970b2a1612b29 on agsh:master.

chriswiggins commented 4 years ago

Thanks @dzek69 - Should we not be then converting this date to UTC before setting it?

Can you print the XML that the camera is returning?

dzek69 commented 4 years ago

Could be different for different cameras but mine's doesn't define timezone, so I cannot really convert it in any way.

The XML:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope                         ><SOAP-ENV:Body><tds:GetSystemDateAndTimeResponse><tds:SystemDateAndTime><tt:DateTimeType>NTP</tt:DateTimeType><tt:DaylightSavings>false</tt:DaylightSavings><tt:LocalDateTime><tt:Time><tt:Hour>0</tt:Hour><tt:Minute>0</tt:Minute><tt:Second>50</tt:Second></tt:Time><tt:Date><tt:Year>1979</tt:Year><tt:Month>11</tt:Month><tt:Day>30</tt:Day></tt:Date></tt:LocalDateTime></tds:SystemDateAndTime></tds:GetSystemDateAndTimeResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

This camera is insecure so I'm not allowing it access to the internet, so the date is wrong.

RogerHardiman commented 4 years ago

Hi I've just borrowed a cheap no-name camera and have the same thing.

Just looking at the Pull Request now.

chriswiggins commented 3 years ago

This should really have a test around it but the changes to the code don't affect the current functionality, so merging in.