Control object for setting the date and time

Any app
Note: This type of object is known as a server object, a special PPS object designed for point-to-point communication between a server and one or more clients. For details, see "Server objects" in the Persistent Publish/Subscribe Developer's Guide.

Message/response format

Commands sent to the /pps/services/clock/control object are of the form:


Responses always reflect the command_string and ID_number that were sent in the message, along with any errors:


The set command

This object accepts only one command:

msg:: id:: dat:json:
set Number {"parameter":"value", "parameter":"value", ...} (see below)

Parameters and values are as follows:

Parameter Value
year 1970-9999
month 1-12
day 1-31
Note: The set command doesn't completely validate input. For example, if you enter a month and day of "2":"31" (February 31), the set command will pass this input to the date command-line utility, which will reject it, but set won't report the error back to you. Remember to sanitize your input.
hour 0-24
minute 0-59
second 0-60
Note: On real hardware (with a hardware clock on the I2C bus), the set command will set the time in the hardware clock. On VMware VMs, the command will set the Neutrino system time but not the hardware clock.


res:: id:: dat:json: err:: errstr::
set Number (whatever was sent in id::) n/a errno_number as appropriate
Note: If your application is concerned with changes to the system clock or time zone, you can monitor the /pps/services/clock/status object.