Windows build fixes.

pull/1239/head
Roger A. Light 7 years ago
parent 947218c975
commit 4dcd977932

@ -18,7 +18,6 @@ Contributors:
#define CLIENT_CONFIG_H #define CLIENT_CONFIG_H
#include <stdio.h> #include <stdio.h>
#include <sys/time.h>
/* pub_client.c modes */ /* pub_client.c modes */
#define MSGMODE_NONE 0 #define MSGMODE_NONE 0

@ -22,6 +22,7 @@ Contributors:
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifndef WIN32 #ifndef WIN32
#include <sys/time.h>
#include <time.h> #include <time.h>
#else #else
#include <process.h> #include <process.h>
@ -45,6 +46,28 @@ static bool connected = true;
static bool disconnect_sent = false; static bool disconnect_sent = false;
static int publish_count = 0; static int publish_count = 0;
static bool ready_for_repeat = false; static bool ready_for_repeat = false;
#ifdef WIN32
static uint64_t next_publish_tv;
static void set_repeat_time(void)
{
uint64_t ticks = GetTickCount64();
next_publish_tv = ticks + cfg.repeat_delay.tv_sec*1000 + cfg.repeat_delay.tv_usec/1000;
}
static int check_repeat_time(void)
{
uint64_t ticks = GetTickCount64();
if(ticks > next_publish_tv){
return 1;
}else{
return 0;
}
}
#else
static struct timeval next_publish_tv; static struct timeval next_publish_tv;
static void set_repeat_time(void) static void set_repeat_time(void)
@ -72,6 +95,7 @@ static int check_repeat_time(void)
} }
return 0; return 0;
} }
#endif
void my_disconnect_callback(struct mosquitto *mosq, void *obj, int rc, const mosquitto_property *properties) void my_disconnect_callback(struct mosquitto *mosq, void *obj, int rc, const mosquitto_property *properties)
{ {

@ -29,8 +29,6 @@ Contributors:
#if defined(__GNUC__) || defined(__clang__) #if defined(__GNUC__) || defined(__clang__)
# define DEPRECATED __attribute__ ((deprecated)) # define DEPRECATED __attribute__ ((deprecated))
#elif defined(_MSC_VER)
# define DEPRECATED __declspec(deprecated)
#else #else
# define DEPRECATED # define DEPRECATED
#endif #endif

@ -41,15 +41,15 @@ in this Software without prior written authorization of the copyright holder.
*/ */
#ifdef WITH_TLS #ifdef WITH_TLS
#include <logging_mosq.h>
#include <mosquitto_internal.h>
#include <net_mosq.h>
#include <openssl/safestack.h> #include <openssl/safestack.h>
#include <openssl/tls1.h> #include <openssl/tls1.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <openssl/ocsp.h> #include <openssl/ocsp.h>
#include <logging_mosq.h>
#include <mosquitto_internal.h>
#include <net_mosq.h>
int mosquitto__verify_ocsp_status_cb(SSL * ssl, void *arg) int mosquitto__verify_ocsp_status_cb(SSL * ssl, void *arg)
{ {
struct mosquitto *mosq = (struct mosquitto *)arg; struct mosquitto *mosq = (struct mosquitto *)arg;

@ -58,9 +58,7 @@ static DltContext dltContext;
static int get_time(struct tm **ti) static int get_time(struct tm **ti)
{ {
#ifdef WIN32 #if defined(__APPLE__)
SYSTEMTIME st;
#elif defined(__APPLE__)
struct timeval tv; struct timeval tv;
#else #else
struct timespec ts; struct timespec ts;
@ -70,8 +68,6 @@ static int get_time(struct tm **ti)
#ifdef WIN32 #ifdef WIN32
s = time(NULL); s = time(NULL);
GetLocalTime(&st);
*ns = st.wMilliseconds*1000000L;
#elif defined(__APPLE__) #elif defined(__APPLE__)
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
s = tv.tv_sec; s = tv.tv_sec;

Loading…
Cancel
Save