diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2006-12-16 00:38:43 +0000 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2006-12-16 00:38:43 +0000 |
commit | 7bdc55cc7113137c5f597a33db9dc240b1bd47da (patch) | |
tree | 074197272ac40b6bd042eb199c340bae79925dcd /src/bin/psql/common.h | |
parent | 281f40187f866f0346ba19ccf033afccf0410d45 (diff) | |
download | postgresql-7bdc55cc7113137c5f597a33db9dc240b1bd47da.tar.gz postgresql-7bdc55cc7113137c5f597a33db9dc240b1bd47da.zip |
enable \timing oputput for \copy commands
Diffstat (limited to 'src/bin/psql/common.h')
-rw-r--r-- | src/bin/psql/common.h | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/bin/psql/common.h b/src/bin/psql/common.h index 3b6d566b33c..3802333e602 100644 --- a/src/bin/psql/common.h +++ b/src/bin/psql/common.h @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2006, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.51 2006/10/04 00:30:05 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.52 2006/12/16 00:38:43 adunstan Exp $ */ #ifndef COMMON_H #define COMMON_H @@ -63,4 +63,31 @@ extern const char *session_username(void); extern char *expand_tilde(char **filename); +/* Workarounds for Windows */ +/* Probably to be moved up the source tree in the future, perhaps to be replaced by + * more specific checks like configure-style HAVE_GETTIMEOFDAY macros. + */ +#ifndef WIN32 + +#include <sys/time.h> + +typedef struct timeval TimevalStruct; + +#define GETTIMEOFDAY(T) gettimeofday(T, NULL) +#define DIFF_MSEC(T, U) \ + ((((int) ((T)->tv_sec - (U)->tv_sec)) * 1000000.0 + \ + ((int) ((T)->tv_usec - (U)->tv_usec))) / 1000.0) +#else + +typedef struct _timeb TimevalStruct; + +#include <sys/types.h> +#include <sys/timeb.h> + +#define GETTIMEOFDAY(T) _ftime(T) +#define DIFF_MSEC(T, U) \ + (((T)->time - (U)->time) * 1000.0 + \ + ((T)->millitm - (U)->millitm)) +#endif + #endif /* COMMON_H */ |