Overview
This endpoint retrieves the current date and time configured on a ZKTeco device. This is useful for verifying time synchronization and troubleshooting attendance timestamp issues.
Path Parameters
The unique identifier of the device
curl -X GET \
https://your-server.com/devices/principal/time
Success Response
Device Not Found
Connection Error
{
"success" : true ,
"device_id" : "principal" ,
"device_time" : "2026-03-06 14:23:45"
}
Response Fields
Indicates whether the request was successful
The device identifier that was queried
The current date and time on the device in format YYYY-MM-DD HH:MM:SS
Error message if the request failed (only present when success is false)
Error Codes
404 : Device not found in the registry
500 : Connection error or device communication failure
The device_time field returns timestamps in the following format:
Format : YYYY-MM-DD HH:MM:SS
Example : 2026-03-06 14:23:45
Timezone : The device’s local timezone (not UTC)
Common Use Cases
Verify Time Synchronization
Compare the device time with your server time to detect drift:
from datetime import datetime
import requests
device_id = "principal"
response = requests.get( f "https://your-server.com/devices/ { device_id } /time" )
data = response.json()
if data[ "success" ]:
device_time = datetime.strptime(data[ "device_time" ], "%Y-%m- %d %H:%M:%S" )
server_time = datetime.now()
drift = abs ((device_time - server_time).total_seconds())
if drift > 60 : # More than 1 minute difference
print ( f "Time drift detected: { drift } seconds" )
# Call sync-time endpoint
else :
print ( "Time is synchronized" )
Troubleshoot Attendance Issues
If attendance timestamps appear incorrect, check the device time:
const checkDeviceTime = async ( deviceId ) => {
const response = await fetch (
`https://your-server.com/devices/ ${ deviceId } /time`
);
const data = await response . json ();
if ( data . success ) {
console . log ( `Device ${ deviceId } time: ${ data . device_time } ` );
console . log ( `Server time: ${ new Date (). toLocaleString () } ` );
}
};
Implementation Notes
This endpoint does not disable the device, making it a lightweight operation
The connection is immediately closed after retrieving the time
Thread-safe: Uses device-specific locks to prevent concurrent operations
No modification is made to the device state