1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-24 14:22:24 +03:00

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.
This commit is contained in:
Tom Lane
2005-06-29 22:51:57 +00:00
parent c33d575899
commit b5f7cff84f
19 changed files with 135 additions and 213 deletions

View File

@ -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;