blob: 802f39bd708ed82a56e8ef3fb41873f0f900175a [file] [log] [blame]
diff -Naur libnova-0.15.0.orig/src/julian_day.c libnova-0.15.0/src/julian_day.c
--- libnova-0.15.0.orig/src/julian_day.c 2018-05-17 15:44:24.543368100 -0400
+++ libnova-0.15.0/src/julian_day.c 2018-05-17 15:57:24.240688000 -0400
@@ -189,17 +189,30 @@
void ln_get_date_from_sys (struct ln_date * date)
{
struct tm * gmt;
+ #ifdef __WIN32__
+ struct posix_timeval tv;
+ struct posix_timezone tz;
+ #else
struct timeval tv;
struct timezone tz;
+ #endif
/* get current time with microseconds precission*/
gettimeofday (&tv, &tz);
/* convert to UTC time representation */
+ #ifdef __WIN32__
+ gmt = gmtime(&tv.posix_tv_sec);
+ #else
gmt = gmtime(&tv.tv_sec);
+ #endif
/* fill in date struct */
+ #ifdef __WIN32__
+ date->seconds = gmt->tm_sec + ((double)tv.posix_tv_usec / 1000000);
+ #else
date->seconds = gmt->tm_sec + ((double)tv.tv_usec / 1000000);
+ #endif
date->minutes = gmt->tm_min;
date->hours = gmt->tm_hour;
date->days = gmt->tm_mday;
diff -Naur libnova-0.15.0.orig/src/libnova/ln_types.h libnova-0.15.0/src/libnova/ln_types.h
--- libnova-0.15.0.orig/src/libnova/ln_types.h 2018-05-17 15:44:24.433994300 -0400
+++ libnova-0.15.0/src/libnova/ln_types.h 2018-05-17 15:54:18.810928500 -0400
@@ -341,16 +341,16 @@
#include <time.h>
-struct timeval
+struct posix_timeval
{
- time_t tv_sec; /* count of seconds since Jan. 1, 1970 */
- long tv_usec; /* and microseconds */
+ time_t posix_tv_sec; /* count of seconds since Jan. 1, 1970 */
+ long posix_tv_usec; /* and microseconds */
};
-struct timezone
+struct posix_timezone
{
- int tz_minuteswest; /* Minutes west of GMT */
- int tz_dsttime; /* DST correction offset */
+ int posix_tz_minuteswest; /* Minutes west of GMT */
+ int posix_tz_dsttime; /* DST correction offset */
};
#endif /* __WIN32__ */
diff -Naur libnova-0.15.0.orig/src/libnova/utility.h libnova-0.15.0/src/libnova/utility.h
--- libnova-0.15.0.orig/src/libnova/utility.h 2018-05-17 15:44:24.465242600 -0400
+++ libnova-0.15.0/src/libnova/utility.h 2018-05-17 16:21:34.418019200 -0400
@@ -21,12 +21,6 @@
#include <libnova/ln_types.h>
-#ifdef __WIN32__
-#include <time.h>
-// cbrt replacement
-#define cbrt(x) pow (x,1.0/3.0)
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -222,7 +216,7 @@
struct tm *gmtime_r (time_t *t, struct tm *gmt);
/* Catches calls to the POSIX gettimeofday and converts them to a related WIN32 version. */
-int gettimeofday(struct timeval *tp, struct timezone *tzp);
+int gettimeofday(struct posix_timeval *tp, struct posix_timezone *tzp);
/* Catches calls to the POSIX strtok_r and converts them to a related WIN32 version. */
char *strtok_r(char *str, const char *sep, char **last);
diff -Naur libnova-0.15.0.orig/src/utility.c libnova-0.15.0/src/utility.c
--- libnova-0.15.0.orig/src/utility.c 2018-05-17 15:44:24.355870400 -0400
+++ libnova-0.15.0/src/utility.c 2018-05-17 16:04:25.653565300 -0400
@@ -678,17 +678,17 @@
#ifdef __WIN32__
/* Catches calls to the POSIX gettimeofday and converts them to a related WIN32 version. */
-int gettimeofday(struct timeval *tv, struct timezone *tz)
+int gettimeofday(struct posix_timeval *tv, struct posix_timezone *tz)
{
struct _timeb timeptr;
_ftime_s (&timeptr);
- tv->tv_sec = timeptr.time;
- tv->tv_usec = timeptr.millitm * 1000;
+ tv->posix_tv_sec = timeptr.time;
+ tv->posix_tv_usec = timeptr.millitm * 1000;
- tz->tz_dsttime = timeptr.dstflag;
- tz->tz_dsttime = timeptr.timezone;
+ tz->posix_tz_dsttime = timeptr.dstflag;
+ tz->posix_tz_dsttime = timeptr.timezone;
return 0;
}