Skip to content

Commit

Permalink
Windows build fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed Apr 17, 2019
1 parent 947218c commit 4dcd977
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.
1 change: 0 additions & 1 deletion client/client_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ and the Eclipse Distribution License is available at
#define CLIENT_CONFIG_H

#include <stdio.h>
#include <sys/time.h>

/* pub_client.c modes */
#define MSGMODE_NONE 0
Expand Down
24 changes: 24 additions & 0 deletions client/pub_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and the Eclipse Distribution License is available at
#include <stdlib.h>
#include <string.h>
#ifndef WIN32
#include <sys/time.h>
#include <time.h>
#else
#include <process.h>
Expand All @@ -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)
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 0 additions & 2 deletions lib/cpp/mosquittopp.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ and the Eclipse Distribution License is available at

#if defined(__GNUC__) || defined(__clang__)
# define DEPRECATED __attribute__ ((deprecated))
#elif defined(_MSC_VER)
# define DEPRECATED __declspec(deprecated)
#else
# define DEPRECATED
#endif
Expand Down
8 changes: 4 additions & 4 deletions lib/net_mosq_ocsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 1 addition & 5 deletions src/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 4dcd977

Please sign in to comment.