summaryrefslogtreecommitdiff
path: root/apps/unix/x11pdf.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2008-09-07 17:09:22 +0200
committerTor Andersson <tor@ghostscript.com>2008-09-07 17:09:22 +0200
commit9682c53bc256f7c17fe0c10e9c8f7225042e0493 (patch)
treece54c24122b9ac3f7d54555f8ce255f52778792f /apps/unix/x11pdf.c
parent10775483c87da8671c9f86d8f3ba48f6a5cc2977 (diff)
downloadmupdf-9682c53bc256f7c17fe0c10e9c8f7225042e0493.tar.xz
Add timersub/timeradd macros (non-standard from BSD) to x11pdf.
Diffstat (limited to 'apps/unix/x11pdf.c')
-rw-r--r--apps/unix/x11pdf.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/unix/x11pdf.c b/apps/unix/x11pdf.c
index c7f2e31b..e7699620 100644
--- a/apps/unix/x11pdf.c
+++ b/apps/unix/x11pdf.c
@@ -15,6 +15,31 @@
#include <sys/types.h>
#include <unistd.h>
+#ifndef timeradd
+#define timeradd(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 >= 1000000) \
+ { \
+ ++(result)->tv_sec; \
+ (result)->tv_usec -= 1000000; \
+ } \
+ } while (0)
+#endif
+
+#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
+
extern int ximage_init(Display *display, int screen, Visual *visual);
extern int ximage_get_depth(void);
extern Visual *ximage_get_visual(void);