Closed nanis closed 3 years ago
Thanks @nanis. Are you able to get time_now compiling on your machine with this patch? I don't have a WIndows machine to test this on, but the patch certainly looks reasonable.
@bcc32 Thank you. Yes, I am able to build it with the patch.
$ pwd
/cygdrive/c/Users/user/src/time_now
$ git branch
master
* msvc-timenow
$ eval $(opam env|dos2unix)
$ ~/.opam/default/bin/dune.exe build -p time_now -j 1
cl src/time_now_stubs.obj
time_now_stubs.c
@bcc32 I should emphasize that I did not set up separate Cygwin and MinGW environments to check those. However, I am assuming if the source continues to compile with gcc
, those environments should be no worse off with this patch.
Got it, that makes sense. I've imported this into our internal repo for review. Thanks for contributing!
Thank you for your work and making these tools available.
Signed-off-by: A. Sinan Unur sinan@unur.com
I built
ocaml
andopam
using the MSVC + Cygwin tools instructions. When I ranopam install core
, most dependent libraries installed without any problems, buttime_now
failed to install:The apparent reason is that Visual Studio does not provide a
sys/time.h
. However, since VS 2015,timespec_get
has been available. Therefore, I added a preprocessor check for whethercl
is being used to compile the C source and implementedtime_now_nanoseconds_since_unix_epoch_or_zero
using that function.The check uses
_MSC_VER
so that the code continues to compile as usual withgcc
using MinGW and Cygwin.