Also compiles / runs without time-based functions in OS
Can now run without need of time() / localtime() and gettimeofday()
diff --git a/include/polarssl/config.h b/include/polarssl/config.h
index 84f4fe1..5742fe5 100644
--- a/include/polarssl/config.h
+++ b/include/polarssl/config.h
@@ -94,6 +94,15 @@
*
#define POLARSSL_HAVE_SSE2
*/
+
+/**
+ * \def POLARSSL_HAVE_TIME
+ *
+ * System has time.h and time() / localtime() / gettimeofday()
+ *
+ * Comment if your system does not support time functions
+ */
+#define POLARSSL_HAVE_TIME
/* \} name */
/**
diff --git a/include/polarssl/ssl.h b/include/polarssl/ssl.h
index 4bc0fad..eca6879 100644
--- a/include/polarssl/ssl.h
+++ b/include/polarssl/ssl.h
@@ -27,8 +27,6 @@
#ifndef POLARSSL_SSL_H
#define POLARSSL_SSL_H
-#include <time.h>
-
#include "config.h"
#include "net.h"
#include "bignum.h"
@@ -60,6 +58,10 @@
#include "zlib.h"
#endif
+#if defined(POLARSSL_HAVE_TIME)
+#include <time.h>
+#endif
+
#if defined(_MSC_VER) && !defined(inline)
#define inline _inline
#else
@@ -306,7 +308,9 @@
*/
struct _ssl_session
{
+#if defined(POLARSSL_HAVE_TIME)
time_t start; /*!< starting time */
+#endif
int ciphersuite; /*!< chosen ciphersuite */
int compression; /*!< chosen compression */
size_t length; /*!< session id length */
diff --git a/include/polarssl/ssl_cache.h b/include/polarssl/ssl_cache.h
index c47330d..979dc14 100644
--- a/include/polarssl/ssl_cache.h
+++ b/include/polarssl/ssl_cache.h
@@ -46,7 +46,9 @@
*/
struct _ssl_cache_entry
{
+#if defined(POLARSSL_HAVE_TIME)
time_t timestamp; /*!< entry timestamp */
+#endif
ssl_session session; /*!< entry session */
#if defined(POLARSSL_X509_PARSE_C)
x509_buf peer_cert; /*!< entry peer_cert */
@@ -87,6 +89,7 @@
*/
int ssl_cache_set( void *data, const ssl_session *session );
+#if defined(POLARSSL_HAVE_TIME)
/**
* \brief Set the cache timeout
* (Default: SSL_CACHE_DEFAULT_TIMEOUT (1 day))
@@ -97,6 +100,7 @@
* \param timeout cache entry timeout
*/
void ssl_cache_set_timeout( ssl_cache_context *cache, int timeout );
+#endif /* POLARSSL_HAVE_TIME */
/**
* \brief Set the cache timeout