rtptools icon indicating copy to clipboard operation
rtptools copied to clipboard

timer{add,sub} for systems that don't have it

Open janstary opened this issue 6 years ago • 5 comments

Properly test for timeradd() and timersub() in have-timer.c Provide the compatibility implementation in compat-timer.c Augment ./configure et al accordingly. Clean up some unused code while here.

janstary avatar Jul 22 '18 15:07 janstary

Strangely, rtpsend uses the timer*() macros but rtpplay does not: it computes by hand. They should be united; in fact, they should both be one program.

janstary avatar Jul 22 '18 22:07 janstary

Thanks for moving timersub/add to compat-timer. I tried build them on Win. The sysdep.h is declaring

extern void	 timersub(struct` timeval *, struct timeval *, struct timeval *);
extern void	 timeradd(struct timeval *, struct timeval *, struct timeval *);

but they are macros in compat-timer.c, and Visual Studio will stop with

1>rtpsend.obj : error LNK2019: unresolved external symbol _timersub referenced in function _send_handler

To solve this matter, I am not sure which one is better. Converting timersub() timeradd() from macro to defining as actual functions. Or let compat-timer.h to be included on rtpsend.

mcd500 avatar Jul 24 '18 16:07 mcd500

Ah, I forgot to remove those after I realized they are macros. It's probably easiest to just removed the offending declarations (done).

janstary avatar Jul 24 '18 18:07 janstary

Does it build for you on win then?

janstary avatar Aug 03 '18 08:08 janstary

Sorry for the late reply. I have tried it. It will build if I change the filename from compat-timer.c to compat-timer.h and then adding #include "compat-timer.h" at the rtpsend.c. The timer{sub,add} are defined as macro inside the compat-timer.c and rtpsend.c needs the timer{sub,add} at compile time. Changing the macro to actual function will work but I am not sure what is the right way to make it build. What would be the good method in this case?

mcd500 avatar Aug 03 '18 12:08 mcd500