| 24 | } |
| 25 | |
| 26 | int unix_rpc_ping_command(cJSON *cmd_msg, cJSON *server_msg, void *data) |
| 27 | { |
| 28 | (void)cmd_msg; |
| 29 | (void)data; |
| 30 | struct timespec ts; |
| 31 | if (clock_gettime(CLOCK_REALTIME, &ts) != 0) |
| 32 | return -1; |
| 33 | |
| 34 | int64_t ts_ms = (int64_t)ts.tv_sec * 1000 + (int64_t)(ts.tv_nsec / 1000000); |
| 35 | if (!cJSON_AddNumberToObject(server_msg, "ts_ms", (double)ts_ms)) |
| 36 | return -1; |
| 37 | return 0; |
| 38 | } |
| 39 | |
| 40 | int unix_rpc_info_command(cJSON *cmd_msg, cJSON *server_msg, void *data) |
| 41 | { |