diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/libpq/libpq-be.h | 9 | ||||
| -rw-r--r-- | src/include/utils/timestamp.h | 12 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/include/libpq/libpq-be.h b/src/include/libpq/libpq-be.h index d42f4e19598..de85ce10d63 100644 --- a/src/include/libpq/libpq-be.h +++ b/src/include/libpq/libpq-be.h @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.55 2006/03/05 15:58:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.56 2006/06/20 22:52:00 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -31,6 +31,7 @@ #include "libpq/hba.h" #include "libpq/pqcomm.h" +#include "utils/timestamp.h" typedef enum CAC_state @@ -80,7 +81,8 @@ typedef struct Port * but since it gets used by elog.c in the same way as database_name and * other members of this struct, we may as well keep it here. */ - struct timeval session_start; /* for session duration logging */ + TimestampTz SessionStartTime; /* backend start time */ + time_t session_start; /* same, in time_t format */ /* * TCP keepalive settings. @@ -97,7 +99,8 @@ typedef struct Port int keepalives_count; /* - * SSL structures + * SSL structures (keep these last so that USE_SSL doesn't affect + * locations of other fields) */ #ifdef USE_SSL SSL *ssl; diff --git a/src/include/utils/timestamp.h b/src/include/utils/timestamp.h index 4e9e0c3f6f7..47832c8b3fc 100644 --- a/src/include/utils/timestamp.h +++ b/src/include/utils/timestamp.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/timestamp.h,v 1.60 2006/04/25 00:25:22 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/timestamp.h,v 1.61 2006/06/20 22:52:00 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -177,6 +177,12 @@ typedef double fsec_t; #define INTERVAL_PRECISION(t) ((t) & INTERVAL_PRECISION_MASK) #define INTERVAL_RANGE(t) (((t) >> 16) & INTERVAL_RANGE_MASK) +#ifdef HAVE_INT64_TIMESTAMP +#define TimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) * 1000)) +#else +#define TimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) / 1000.0)) +#endif + /* Set at postmaster start */ extern TimestampTz PgStartTime; @@ -293,7 +299,11 @@ extern Datum pgsql_postmaster_start_time(PG_FUNCTION_ARGS); extern TimestampTz GetCurrentTimestamp(void); +extern void TimestampDifference(TimestampTz start_time, TimestampTz stop_time, + long *secs, int *microsecs); + extern TimestampTz time_t_to_timestamptz(time_t tm); +extern time_t timestamptz_to_time_t(TimestampTz t); extern int tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *dt); extern int timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm, |
