2018-07-24 14:59:03 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <assert.h>
|
|
|
|
|
2018-09-25 08:34:04 +00:00
|
|
|
#include "esp_transport_utils.h"
|
2018-07-24 14:59:03 +00:00
|
|
|
|
2019-11-12 16:42:51 +00:00
|
|
|
struct timeval* esp_transport_utils_ms_to_timeval(int timeout_ms, struct timeval *tv)
|
2018-07-24 14:59:03 +00:00
|
|
|
{
|
2019-11-12 16:42:51 +00:00
|
|
|
if (timeout_ms == -1) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2018-07-24 14:59:03 +00:00
|
|
|
tv->tv_sec = timeout_ms / 1000;
|
|
|
|
tv->tv_usec = (timeout_ms - (tv->tv_sec * 1000)) * 1000;
|
2019-11-12 16:42:51 +00:00
|
|
|
return tv;
|
2018-07-24 14:59:03 +00:00
|
|
|
}
|