tony2001 / pinba_extension

Pinba PHP extension
http://pinba.org
GNU Lesser General Public License v2.1
83 stars 22 forks source link

cannot build on Solaris 10, timersub() undef #9

Closed drook closed 11 years ago

drook commented 11 years ago

timersub() macro doesn't exist on Solaris 10. in order to build pinba on Solaris 10 the following code needs to be added (I add it to pinba.c):

#ifndef timersub
# define timersub(a, b, result)                     \
    do {                                \
        (result)->tv_sec = (a)->tv_sec - (b)->tv_sec;       \
        (result)->tv_usec = (a)->tv_usec - (b)->tv_usec;        \
        if ((result)->tv_usec < 0) {                            \
            --(result)->tv_sec;             \
            (result)->tv_usec += 1000000;           \
        }                                                       \
    } while (0)
#endif

After this everything works like a charm. Thanks for great piece of software.

drook commented 11 years ago

Yeah, I stole this patch from here: http://mail.gnu.org.ua/mailman/listarchive/bug-mailfromd/2011-03/msg00004.html (I think it's GPL'd).

tony2001 commented 11 years ago

Commited the patch, thanks!