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