aboutsummaryrefslogtreecommitdiff
path: root/plugins/utils.h.in
diff options
context:
space:
mode:
authorGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2002-10-16 04:56:19 +0000
committerGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2002-10-16 04:56:19 +0000
commit6cbf1dd4a321ced6dffa5ca590692d283731f987 (patch)
tree80abc79978b6894c786ecb27e48a00f429df3027 /plugins/utils.h.in
parent509f71f79e62c52299ab61820c70726bc3a8f9cb (diff)
downloadmonitoring-plugins-6cbf1dd4a321ced6dffa5ca590692d283731f987.tar.gz
start support for gettimeofday and tv_usec
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@116 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/utils.h.in')
-rw-r--r--plugins/utils.h.in33
1 files changed, 26 insertions, 7 deletions
diff --git a/plugins/utils.h.in b/plugins/utils.h.in
index 46b152a3..e910c417 100644
--- a/plugins/utils.h.in
+++ b/plugins/utils.h.in
@@ -45,13 +45,31 @@ int is_percentage (char *);
int is_option (char *);
+/* generalized timer that will do milliseconds if available */
+#ifndef HAVE_GETTIMEOFDAY
+struct timeval {
+ long tv_sec; /* seconds */
+ long tv_usec; /* microseconds */
+};
+
+struct timezone {
+ int tz_minuteswest; /* minutes W of Greenwich */
+ int tz_dsttime; /* type of dst correction */
+};
+
+#define gettimeofday (tvp,tz) {\
+ tvp->tv_usec=0;\
+ tvp->tv_sec=(long)time();\
+}
+#endif
+
/* Handle strings safely */
void strip (char *buffer);
char *strscpy (char *dest, char *src);
char *strscat (char *dest, char *src);
char *strnl (char *str);
-char *ssprintf (char *str, const char *fmt, ...);
+char *ssprintf (char *str, const char *fmt, ...); /* deprecate for asprintf */
char *strpcpy (char *dest, const char *src, const char *str);
char *strpcat (char *dest, const char *src, const char *str);
@@ -61,15 +79,15 @@ int max_state(int, int);
#define max(a,b) ((a)>(b))?(a):(b)
#define usage(msg) {\
- printf(msg);\
- print_usage();\
-exit(STATE_UNKNOWN);\
+ printf(msg);\
+ print_usage();\
+ exit(STATE_UNKNOWN);\
}
#define usage2(msg,arg) {\
- printf("%s: %s - %s\n",PROGNAME,msg,arg);\
- print_usage();\
- exit(STATE_UNKNOWN);\
+ printf("%s: %s - %s\n",PROGNAME,msg,arg);\
+ print_usage();\
+ exit(STATE_UNKNOWN);\
}
#define state_text(a) \
@@ -94,3 +112,4 @@ exit(STATE_UNKNOWN);\
{"warning",required_argument,0,'w'},\
{"hostname",required_argument,0,'H'},\
{"file",required_argument,0,'F'}
+