tencent cloud

IoT Hub

Release Notes and Announcements
Release Notes
Product Introduction
Overview
Features
Strengths
Use Cases
Use Limits
Basic Concepts
Getting Started
Quick Start
Scenario 1: Device Interconnection
Scenario 2: Device Status Reporting and Setting
MQTT.fx Connection Guide
Console Guide
Product Management
Rule Engine
Sub-account Access to IoT Hub
Firmware Upgrade
Resource Management
Certificate Management
Developer Manual
Feature Components
Signature Algorithm
Device Authentication
Device Connection Protocol
Gateway Subdevice
Message Communication
Device Shadow
Device Firmware Upgrade
Remote Device Configuration
Resource Management
Device Log Reporting
NTP Service
Device Connection Manual
Device Connection Overview
Connection Based on SDK for C
Connection Based on SDK for Android
Connection Based on SDK for Java
Connection Based on SDK for Python
API Documentation
History
Introduction
API Category
Making API Requests
Device Shadow APIs
Device APIs
CA Certificate APIs
Product APIs
Data Types
Error Codes
FAQs
General
Device Connection and Reporting
Rule Engine
Console
IoT Hub Policy
Privacy Policy
Data Privacy And Security Agreement
Glossary

NTP Service

PDF
Focus Mode
Font Size
Last updated: 2024-12-27 15:54:13

Feature Overview

The NTP feature is mainly used to solve the problem with resource-constrained devices where they don't have the NTP service and thus have no accurate timestamps. The following two topics are required for this feature:
Request topic (for publishing): $sys/operation/${ProductId}/${DeviceName}.
Response topic (for subscribing): $sys/operation/result/${ProductId}/${DeviceName}.

How It Works

The IoT Hub platform draws on the principles of the NTP protocol and uses the platform itself as an NTP server. After a device requests the platform, the platform will return the NTP time. After the device receives the response, it will calculate the current accurate time based on the request time and receipt time.

Directions

1. The device sends a message in JSON format with the following content to $sys/operation/${ProductId}/${DeviceName} to request the platform for the NTP time and records the request time deviceSendtime:
{
"type": "get",
"resource": [
"time"
]
}
2. The platform returns the NTP time through $sys/operation/result/${ProductId}/${DeviceName} with a message in JSON format with the following content, and the device records the receipt time deviceRecvtime:
{
"type": "get",
"time": 1621562342,
"ntptime1": 1621562342773,
"ntptime2": 1621562342773
}
3. The accurate time is calculated through the NTP time (${ntptime1} + ${ntptime2}) received by the device, receipt time (${deviceRecvtime}), and request time (${deviceSendtime}) as follows: Accurate time =(${ntptime1} + ${ntptime2} + ${deviceRecvtime} - ${deviceSendtime}) / 2

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback