Skip to content

Commit 4eb224f

Browse files
committed
v0.8.0-14
1 parent 1800356 commit 4eb224f

4 files changed

Lines changed: 66 additions & 54 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.8.0-14] - 2026-09-16
11+
12+
### Fixed
13+
- `getSystemDateAndTime()` now recalculates `timeShift` on every call instead of only
14+
the first. Previously, if the device's clock drifted, was NTP-corrected, or the
15+
device rebooted after the first calculation, `timeShift` stayed stale for the life
16+
of the `Cam` object and every subsequent WS-Security-authenticated request would
17+
keep failing (seen as persistent 400 errors) until a new `Cam` was created.
18+
1019
## [0.8.0-13] - 2026-08-30
1120

1221
### Fixed
@@ -93,7 +102,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
93102
### Fixed
94103
- getAudioEncoderConfigurationOptions() to take options rather that just a token
95104

96-
[Unreleased]: https://github.com/ConfiguredThings/sfjsComponents/compare/v0.8.0-12...HEAD
105+
[Unreleased]: https://github.com/ConfiguredThings/sfjsComponents/compare/v0.8.0-14...HEAD
106+
[0.8.0-14]: https://github.com/ConfiguredThings/sfjsComponents/compare/v0.8.0-13...v0.8.0-14
107+
[0.8.0-13]: https://github.com/ConfiguredThings/sfjsComponents/compare/v0.8.0-12...v0.8.0-13
97108
[0.8.0-12]: https://github.com/ConfiguredThings/sfjsComponents/compare/v0.8.0-11...v0.8.0-12
98109
[0.8.0-11]: https://github.com/ConfiguredThings/sfjsComponents/compare/v0.8.0-10...v0.8.0-11
99110
[0.8.0-10]: https://github.com/ConfiguredThings/sfjsComponents/compare/v0.8.0-9...v0.8.0-10

‎lib/cam.js‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,11 @@ Cam.prototype.getSystemDateAndTime = function(callback) {
500500
let dt = linerase(dateTime[0]);
501501
time = new Date(Date.UTC(dt.date.year, dt.date.month - 1, dt.date.day, dt.time.hour, dt.time.minute, dt.time.second));
502502
}
503-
if (!this.timeShift) {
504-
this.timeShift = time - (process.uptime() * 1000);
505-
}
503+
// Recalculate on every call (not just the first) so we self-correct if the
504+
// device's clock drifts, reboots or gets NTP-corrected after startup - otherwise
505+
// a stale timeShift causes every subsequent WS-Security timestamp to be wrong,
506+
// and requests keep failing indefinitely until the Cam object is recreated.
507+
this.timeShift = time - (process.uptime() * 1000);
506508
callback.call(this, err, time, xml);
507509
} catch (err) {
508510
callback.call(this, err, null, xml);
@@ -538,9 +540,8 @@ Cam.prototype.getSystemDateAndTime = function(callback) {
538540
let dt = linerase(dateTime[0]);
539541
time = new Date(Date.UTC(dt.date.year, dt.date.month - 1, dt.date.day, dt.time.hour, dt.time.minute, dt.time.second));
540542
}
541-
if (!this.timeShift) {
542-
this.timeShift = time - (process.uptime() * 1000);
543-
}
543+
// See comment in the unauthenticated branch above - recalc every call.
544+
this.timeShift = time - (process.uptime() * 1000);
544545
callback.call(this, err, time, xml);
545546
} catch (err) {
546547
callback.call(this, err, null, xml);

‎package-lock.json‎

Lines changed: 46 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@configuredthings/onvif",
3-
"version": "0.8.0-13",
3+
"version": "0.8.0-14",
44
"author": "Andrew D.Laptev <a.d.laptev@gmail.com>",
55
"description": "Client to ONVIF NVT devices Profile S: cameras",
66
"main": "lib/onvif.js",

0 commit comments

Comments
 (0)