Hello Ted, I agree an abstraction level is required but for the time being I am following the TDD approach. So once I have something working, I will refactor it before submitting any patches. I will go with something and only granular to milliseconds as you propose. I am also facing another issue which might require adding a boost dependency and it's related to the pthread library which is not available on Windows. After checking Qpid C++ broker code, it was solved on Windows by using boost thread library. You can check for example https://github.com/apache/qpid/blob/trunk/qpid/cpp/src/qpid/sys/windows/Mutex.h So, how about adding a dependency to boost only for windows platform via Cmake? This way, I can be inspired by Qpid C++ Broker code for threading and no extra dependency is added for Linux/Unix.Or do you propose something better? PS: At some point, it might even be intelligent to extract the common code from Qpid C++ broker, Proton and Dispatcher to create a common "utils" library for threading, logging, daemon/service creation ... Regards,Adel
> Subject: Re: [Qpid-dispatch] timespec not defined on Windows > To: [email protected] > From: [email protected] > Date: Fri, 22 Apr 2016 12:35:50 -0400 > > Adel, > > First of all, we should create an abstraction for timespec that is > usable on all platforms and then provide OS-specific implementations. > Dispatch doesn't currently need time at granularity above milliseconds. > > To answer your question, I don't want to solve this in a way that > requires new dependencies in Linux like Boost. > > -Ted > > On 04/22/2016 12:24 PM, Adel Boutros wrote: > > Hello, > > > > While compiling Qpid-dispatch on Windows using Visual Studio 2013 64-bit, I > > encountered a code related to time which doesn't work under windows. > > > > In *src\server.c* thread_run method, there is a block of code using timespec > > which is not defined in Windows > > > > /struct timespec tv; > > clock_gettime(CLOCK_REALTIME, &tv); > > qd_timestamp_t milliseconds = ((qd_timestamp_t)tv.tv_sec) * 1000 + > > tv.tv_nsec / 1000000; > > qd_timer_visit_LH(milliseconds);/ > > > > I have found two ways to solve it: > > 1) One inspired from Qpid C++ broker > > (qpid\cpp\src\qpid\sys\windows\Time.cpp: FromEpoch and outputHiresNow) but > > this will add a dependency to Boost for qpid-dispatch. > > 2) The other found on Stackoverflow timespec-equivalent-for-windows > > <http://stackoverflow.com/questions/8583308/timespec-equivalent-for-windows> > > > > Which one would you find more appropriate? > > > > Regards, > > Adel Boutros > > www.murex.com > > > > > > > > -- > > View this message in context: > > http://qpid.2158936.n2.nabble.com/Qpid-dispatch-timespec-not-defined-on-Windows-tp7642532.html > > Sent from the Apache Qpid users mailing list archive at Nabble.com. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] >
