comparison scpmisc.h @ 294:5686ee0a3338

put back the TIMEVAL_TO_TIMESPEC and timersub macros for Linux
author Matt Johnston <matt@ucc.asn.au>
date Sat, 11 Mar 2006 14:57:12 +0000
parents b72f98803e46
children 83d85b28b353
comparison
equal deleted inserted replaced
291:55a99934db87 294:5686ee0a3338
44 char *xstrdup(const char *); 44 char *xstrdup(const char *);
45 45
46 char *ssh_get_progname(char *); 46 char *ssh_get_progname(char *);
47 void fatal(char* fmt,...); 47 void fatal(char* fmt,...);
48 void sanitise_stdfd(void); 48 void sanitise_stdfd(void);
49
50 /* Required for non-BSD platforms, from OpenSSH's defines.h */
51 #ifndef timersub
52 #define timersub(a, b, result) \
53 do { \
54 (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
55 (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
56 if ((result)->tv_usec < 0) { \
57 --(result)->tv_sec; \
58 (result)->tv_usec += 1000000; \
59 } \
60 } while (0)
61 #endif
62
63 #ifndef TIMEVAL_TO_TIMESPEC
64 #define TIMEVAL_TO_TIMESPEC(tv, ts) { \
65 (ts)->tv_sec = (tv)->tv_sec; \
66 (ts)->tv_nsec = (tv)->tv_usec * 1000; \
67 }
68 #endif
69