staticlibs / ccronexpr

Cron expression parsing in ANSI C
Apache License 2.0
150 stars 78 forks source link

Compile with mingw32 #3

Closed dmtmalin closed 7 years ago

dmtmalin commented 7 years ago

Hi! If to use mingw32, then a error: ccronexpr.cpp:83: error: undefined reference to `_mkgmtime' Maybe can use this for UTC time? #ifdef _WIN32 time_t cron_mktime(struct tm* tm) { return mktime(tm) - timezone; }

staticlibs commented 7 years ago

Hi, I wonder what version of mingw are you using? The following worked for me with mingw from here:

gcc ccronexpr.c ccronexpr_test.c -I. -Wall -Wextra -std=c89 && a.exe
gcc --version
> gcc (GCC) 6.3.0

I will happily accept a PR for mingw32, if you submit one, assuming that time.h logic for MSVC and Linux GCC will stay unchanged. time.h API is really hairy, afraid to change current variant that works there.

dmtmalin commented 7 years ago

I'm used MinGW with Qt:

C:\Qt\Tools\mingw530_32\bin>gcc.exe --version
gcc.exe (i686-posix-dwarf-rev0, Built by MinGW-W64 project) 5.3.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
dmtmalin commented 7 years ago

I'm try return mktime(tm) - timezone; tests is successful.

staticlibs commented 7 years ago

Mingw should work now with #4 merged, closing the issue.