mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-09-21 15:23:46 +08:00
Windows build fixes.
This commit is contained in:
@@ -18,7 +18,6 @@ Contributors:
|
||||
#define CLIENT_CONFIG_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
/* pub_client.c modes */
|
||||
#define MSGMODE_NONE 0
|
||||
|
||||
@@ -22,6 +22,7 @@ Contributors:
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifndef WIN32
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#else
|
||||
#include <process.h>
|
||||
@@ -45,6 +46,28 @@ static bool connected = true;
|
||||
static bool disconnect_sent = false;
|
||||
static int publish_count = 0;
|
||||
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 void set_repeat_time(void)
|
||||
@@ -72,6 +95,7 @@ static int check_repeat_time(void)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
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__)
|
||||
# define DEPRECATED __attribute__ ((deprecated))
|
||||
#elif defined(_MSC_VER)
|
||||
# define DEPRECATED __declspec(deprecated)
|
||||
#else
|
||||
# define DEPRECATED
|
||||
#endif
|
||||
|
||||
+4
-4
@@ -41,15 +41,15 @@ in this Software without prior written authorization of the copyright holder.
|
||||
*/
|
||||
|
||||
#ifdef WITH_TLS
|
||||
#include <logging_mosq.h>
|
||||
#include <mosquitto_internal.h>
|
||||
#include <net_mosq.h>
|
||||
|
||||
#include <openssl/safestack.h>
|
||||
#include <openssl/tls1.h>
|
||||
#include <openssl/ssl.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)
|
||||
{
|
||||
struct mosquitto *mosq = (struct mosquitto *)arg;
|
||||
|
||||
+1
-5
@@ -58,9 +58,7 @@ static DltContext dltContext;
|
||||
|
||||
static int get_time(struct tm **ti)
|
||||
{
|
||||
#ifdef WIN32
|
||||
SYSTEMTIME st;
|
||||
#elif defined(__APPLE__)
|
||||
#if defined(__APPLE__)
|
||||
struct timeval tv;
|
||||
#else
|
||||
struct timespec ts;
|
||||
@@ -70,8 +68,6 @@ static int get_time(struct tm **ti)
|
||||
#ifdef WIN32
|
||||
s = time(NULL);
|
||||
|
||||
GetLocalTime(&st);
|
||||
*ns = st.wMilliseconds*1000000L;
|
||||
#elif defined(__APPLE__)
|
||||
gettimeofday(&tv, NULL);
|
||||
s = tv.tv_sec;
|
||||
|
||||
Reference in New Issue
Block a user