Fix mg_time on mbed and make DNS work around epoch

PUBLISHED_FROM=c1aeef9dc25baba794b3269b44441c5bafbca5a8
This commit is contained in:
Marko Mikulicic authored and Cesanta Bot committed 2016-10-20 22:36:39 +00:00
1 parent 5bbf24bf41
commit 5bd3df7a0f
2 files changed
+56 -3

No files matched your search

+45
View File
@@ -761,10 +761,55 @@ int _stat(const char *pathname, struct stat *st);
/* Amalgamated: #include "mbed.h" */
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#ifndef CS_ENABLE_STDIO
#define CS_ENABLE_STDIO 1
#endif
/*
* mbed can be compiled with the ARM compiler which
* just doesn't come with a gettimeofday shim
* because it's a BSD API and ARM targets embedded
* non-unix platforms.
*/
#if defined(__ARMCC_VERSION) || defined(__ICCARM__)
#define _TIMEVAL_DEFINED
#define gettimeofday _gettimeofday
/* copied from GCC on ARM; for some reason useconds are signed */
typedef long suseconds_t; /* microseconds (signed) */
struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* and microseconds */
};
#endif
#if MG_NET_IF == MG_NET_IF_SIMPLELINK
typedef int sock_t;
#define INVALID_SOCKET (-1)
#define to64(x) strtoll(x, NULL, 10)
#define INT64_FMT PRId64
#define INT64_X_FMT PRIx64
#define SIZE_T_FMT "u"
#define SOMAXCONN 8
const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
char *inet_ntoa(struct in_addr in);
int inet_pton(int af, const char *src, void *dst);
#endif /* MG_NET_IF == MG_NET_IF_SIMPLELINK */
#endif /* CS_PLATFORM == CS_P_MBED */
#endif /* CS_COMMON_PLATFORMS_PLATFORM_MBED_H_ */
#ifdef MG_MODULE_LINES