Browse Source

Merge pull request #145 from troky/master

API: Fixed timeval struct formatting.
build-mingw
Noel Maersk 11 years ago
parent
commit
609b4f0c5f
  1. 6
      api.c

6
api.c

@ -1005,9 +1005,9 @@ static struct api_data *print_data(struct api_data *root, char *buf, bool isjson @@ -1005,9 +1005,9 @@ static struct api_data *print_data(struct api_data *root, char *buf, bool isjson
sprintf(buf, "%s", *((bool *)(root->data)) ? TRUESTR : FALSESTR);
break;
case API_TIMEVAL:
snprintf(buf, sizeof(buf), "%ld.%06ld",
(long)((struct timeval *)(root->data))->tv_sec,
(long)((struct timeval *)(root->data))->tv_usec);
snprintf(buf, sizeof(buf), "%"PRIu64".%06lu",
(uint64_t)((struct timeval *)(root->data))->tv_sec,
(unsigned long)((struct timeval *)(root->data))->tv_usec);
break;
case API_TEMP:
sprintf(buf, "%.2f", *((float *)(root->data)));

Loading…
Cancel
Save