diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-06-29 22:51:57 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-06-29 22:51:57 +0000 |
commit | b5f7cff84f57a189ed5c9dd59efe8d2568649d0d (patch) | |
tree | 77b5a25a7c4a62145ba89a578018121b3246b82d /src/backend/libpq/crypt.c | |
parent | c33d575899593a46a5b9a76e4e0ef6f9d81e55dd (diff) | |
download | postgresql-b5f7cff84f57a189ed5c9dd59efe8d2568649d0d.tar.gz postgresql-b5f7cff84f57a189ed5c9dd59efe8d2568649d0d.zip |
Clean up the rather historically encumbered interface to now() and
current time: provide a GetCurrentTimestamp() function that returns
current time in the form of a TimestampTz, instead of separate time_t
and microseconds fields. This is what all the callers really want
anyway, and it eliminates low-level dependencies on AbsoluteTime,
which is a deprecated datatype that will have to disappear eventually.
Diffstat (limited to 'src/backend/libpq/crypt.c')
-rw-r--r-- | src/backend/libpq/crypt.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/backend/libpq/crypt.c b/src/backend/libpq/crypt.c index d9c95d1b9ac..297db1eea91 100644 --- a/src/backend/libpq/crypt.c +++ b/src/backend/libpq/crypt.c @@ -9,7 +9,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/libpq/crypt.c,v 1.63 2005/06/28 05:08:56 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/libpq/crypt.c,v 1.64 2005/06/29 22:51:54 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -25,7 +25,7 @@ #include "miscadmin.h" #include "storage/fd.h" #include "nodes/pg_list.h" -#include "utils/nabstime.h" +#include "utils/timestamp.h" int @@ -149,19 +149,13 @@ md5_crypt_verify(const Port *port, const char *role, char *client_pass) else { TimestampTz vuntil; - AbsoluteTime sec; - int usec; - TimestampTz curtime; vuntil = DatumGetTimestampTz(DirectFunctionCall3(timestamptz_in, CStringGetDatum(valuntil), ObjectIdGetDatum(InvalidOid), Int32GetDatum(-1))); - sec = GetCurrentAbsoluteTimeUsec(&usec); - curtime = AbsoluteTimeUsecToTimestampTz(sec, usec); - - if (vuntil < curtime) + if (vuntil < GetCurrentTimestamp()) retval = STATUS_ERROR; else retval = STATUS_OK; |