On Wed, Jun 15, 2016 at 12:49 PM, Gregg Reynolds <dev at mobileink.com> wrote:
> > > On Wed, Jun 15, 2016 at 12:42 PM, Thiago Macieira < > thiago.macieira at intel.com> wrote: > >> On quarta-feira, 15 de junho de 2016 09:23:54 PDT Gregg Reynolds wrote: >> > Reviewers of https://gerrit.iotivity.org/gerrit/#/c/8603/ rightly >> pointed >> > out that it is not maximally portable. FWIW I do not think patches that >> > make Iotivity run on a new platform without breaking existing platforms >> > should be asked to also solve problems on all possible platforms, but >> > that's a separate issue. The purpose of this message is to sketch a >> > possible way of dealing with timers in a portable way. >> >> Hi Gregg >> >> You're right: you can't be asked to test a platform that isn't supported >> yet >> and you may not have access to. However, if someone makes a suggestion to >> "do >> A instead of B" because then other platforms will work, you should at >> least >> attempt that. >> > > Please don't assume I did not. > >> >> > Code that runs on Darwin uses #ifdef on _POSIX_TIMERS to select >> > "clock_gettime" else "gettimeofday" ; Darwin has the latter not the >> former. >> > In patch 8603 (link above) I tried to make the code in the offending >> files >> > follow the working code in the other files. >> >> And I asked you to instead #ifdef CLOCK_REALTIME, since that will work on >> OpenBSD too, which doesn't define _POSIX_TIMERS but has clock_gettime. > > > Please read entire msg before responding. ;) > > I'm a little embarrassed to report that Ossama suggested we look at using > OICGetCurrentTime() > in resource/c_common/oic_time/. Which I knew about but for some reason it > never occurred to me. I don't know if that will Solve All Problems but if > it's good enough that would be great. > Might work, but it has the same problem: lots of #ifdefs. Here's a nutty idea: just use time(). Does Iotivity really need sub-second timing? I don't know the code that well but I'm going to go out on a limb and say no. The first arg to PMTimeout is wait time *in seconds*. Iotivity is an application-level protocol; I doubt it needs subsecond timing. If that's the case, time() is defined by the c standard lib and so should run almost everywhere. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20160615/09699061/attachment.html>
