Skip to main content

Timestamp Handling

Viewtron devices use several different timestamp formats across IPC and NVR posts. This page documents each format and how to interpret them.

Timestamp Formats

SourceFieldFormatExampleResolution
IPC alarm push (v1.7)dataTimeFormatted string2026-03-29 09:58:21 or 11-19-2025 12:15:11 PMSeconds
IPC alarm data (v1.0)currentTimeUnix timestamp1732045234 (10 digits) or 1732045234000 (13 digits)Seconds or milliseconds
IPC traject/smartData (v1.7)currentTimeUnix microseconds1774646121524166 (16 digits)Microseconds
NVR (v2.0)currentTimeUnix microseconds1772056914000000 (16 digits)Microseconds

Converting Microsecond Timestamps

To convert microsecond timestamps to seconds, divide by 1,000,000 (not 1,000).

# NVR or IPC v1.7 microsecond timestamp
current_time = 1772056914604000

# Convert to seconds
timestamp_seconds = current_time / 1_000_000 # 1772056914.604

# Convert to datetime
from datetime import datetime
dt = datetime.fromtimestamp(timestamp_seconds)
# 2026-02-26 10:21:54.604000

Identifying the Format

You can determine the timestamp format by the number of digits:

DigitsFormatDivision Factor
10Unix seconds1
13Unix milliseconds1,000
16Unix microseconds1,000,000
Vehicle LPR timestamp anomaly

The NVR vehicle (LPR) detection type has been observed sending a 20-digit currentTime value (e.g., 18445822972087551616). This appears to be a firmware bug. Use the server receive time as a fallback for LPR events.

Application Guides

For a working implementation that handles all timestamp formats, see the Webhook Event Notification API.