head	1.10;
access;
symbols
	Version_2_1:1.7
	C_Demo_1:1.3;
locks; strict;
comment	@ * @;


1.10
date	92.02.19.01.51.53;	author mer;	state Exp;
branches;
next	1.9;

1.9
date	91.11.09.01.53.14;	author mer;	state Exp;
branches;
next	1.8;

1.8
date	91.04.28.09.14.25;	author cimarron;	state Exp;
branches;
next	1.7;

1.7
date	90.09.25.16.50.19;	author kemnitz;	state Exp;
branches;
next	1.6;

1.6
date	90.05.15.13.05.25;	author mao;	state Exp;
branches;
next	1.5;

1.5
date	90.05.01.16.10.03;	author mao;	state Exp;
branches;
next	1.4;

1.4
date	90.04.21.11.05.05;	author mao;	state Exp;
branches;
next	1.3;

1.3
date	89.09.05.17.26.43;	author mao;	state C_Demo_1;
branches;
next	1.2;

1.2
date	89.02.02.16.15.12;	author aoki;	state Stab;
branches;
next	1.1;

1.1
date	89.01.17.05.58.45;	author cimarron;	state Exp;
branches;
next	;


desc
@@


1.10
log
@changes for the new abstime implementation
@
text
@/*
 * tim.c --
 *	POSTGRES time code.
 */

#include "tmp/postgres.h"

RcsId("$Header: /u/mer/pg/src/utils/adt/RCS/tim.c,v 1.9 1991/11/09 01:53:14 mer Exp mer $");

bool TimeIsBefore ARGS((Time time1 , Time time2 ));

bool
TimeIsBefore(time1, time2)		/* XXX remove this */
	Time	time1;
	Time	time2;
{
	return (AbsoluteTimeIsBefore(time1, time2));
}
@


1.9
log
@function prototyping
@
text
@a6 1
#include "tmp/miscadmin.h"
d8 1
a8 1
RcsId("$Header: /users/mer/postgres/src/utils/adt/RCS/tim.c,v 1.8 1991/04/28 09:14:25 cimarron Exp $");
a9 2
bool AbsoluteTimeIsBefore ARGS((AbsoluteTime time1 , AbsoluteTime time2 ));
bool AbsoluteTimeIsAfter ARGS((AbsoluteTime time1 , AbsoluteTime time2 ));
a10 31

/*
 *  AbsoluteTimeIsBefore -- true iff time1 is before time2.
 *
 *	Since we store AbsoluteTimes as unsigned quantities, the comparison
 *	below would fail for times before the Unix epoch.  We cast them to
 *	signed quantities for the sake of this comparison, even though it
 *	violates the type-hiding abstraction.
 */

bool
AbsoluteTimeIsBefore(time1, time2)
	AbsoluteTime	time1;
	AbsoluteTime	time2;
{
	Assert(AbsoluteTimeIsValid(time1));
	Assert(AbsoluteTimeIsValid(time2));

	return ((bool)((int32) time1 < (int32) time2));
}

bool
AbsoluteTimeIsAfter(time1, time2)
	AbsoluteTime	time1;
	AbsoluteTime	time2;
{
	Assert(AbsoluteTimeIsValid(time1));
	Assert(AbsoluteTimeIsValid(time2));

	return ((bool) ((int32) time1 > (int32) time2));
}
@


1.8
log
@Converted IsValid code into macros and added an improved NodeIsType scheme
@
text
@d9 5
a13 1
RcsId("$Header: RCS/tim.c,v 1.7 90/09/25 16:50:19 kemnitz Exp Locker: cimarron $");
@


1.7
log
@Updating from revision 1.6 to revision 1.8
@
text
@d9 1
a9 40
RcsId("$Header: RCS/tim.c,v 1.8 90/08/18 00:42:20 cimarron Exp $");

SystemTime
GetSystemTime()			/* XXX incorrect place to define this */
{
	return (time(0l));
}

bool
AbsoluteTimeIsValid(time)
	AbsoluteTime	time;
{
	return ((bool)(time != InvalidAbsoluteTime));
}

bool
RelativeTimeIsValid(time)
	RelativeTime	time;
{
	return ((bool)(time != InvalidRelativeTime));
}

bool
TimeIsValid(time)			/* XXX remove this */
	Time	time;
{
	return (AbsoluteTimeIsValid(time));
}

AbsoluteTime
GetCurrentAbsoluteTime()
{
	return ((Time)GetSystemTime());
}

AbsoluteTime
GetCurrentTime()			/* XXX remove this */
{
	return (GetCurrentAbsoluteTime());
}
@


1.6
log
@use TimeIsBefore, TimeIsAfter correctly
@
text
@d6 2
a7 2
#include "c.h"
#include "os.h"		/* XXX ??? */
d9 1
a9 3
#include "tim.h"

RcsId("$Header: RCS/tim.c,v 1.5 90/05/01 16:10:03 mao Exp Locker: mao $");
@


1.5
log
@AbsoluteTimeIsBefore now tests for AbsoluteTimeIsSameOrBefore.  this is
a small semantic change that does not affect any of the callers of this
routine.  we simply declare that if two times are identical, then they
pass this test.
@
text
@d11 1
a11 1
RcsId("$Header: RCS/tim.c,v 1.4 90/04/21 11:05:05 mao Exp Locker: mao $");
a58 7
 *
 *	Finally, note that this isn't really "before" -- it's "at or before",
 *	because "now" means "at the beginning of the current transaction",
 *	and we use check the specified time against the current transaction
 *	time in time queries.  This means that the CurrentTransactionTime
 *	needs to be "before" itself, so to speak.  Of course, if this code
 *	ever travels at close to the speed of light in a rocket ship...
d69 12
a80 1
	return ((bool)((int32) time1 <= (int32) time2));
@


1.4
log
@time range queries work
@
text
@d11 1
a11 1
RcsId("$Header: RCS/tim.c,v 1.3 89/09/05 17:26:43 mao C_Demo_1 Locker: mao $");
d59 7
d76 1
a76 1
	return ((bool)((int32) time1 < (int32) time2));
@


1.3
log
@Working version of C-only demo
@
text
@d11 1
a11 1
RcsId("$Header: /usr6/postgres/mao/postgres/src/utils/adt/RCS/tim.c,v 1.2 89/02/02 16:15:12 aoki Stab $");
d52 9
d69 1
a69 1
	return ((bool)(time1 < time2));
@


1.2
log
@MERGE WITH OLD TREE
@
text
@d11 1
a11 1
RcsId("$Header: tim.c,v 1.2 88/08/20 01:31:02 aoki Locked $");
@


1.1
log
@Initial revision
@
text
@a0 1

a1 26
 * 
 * POSTGRES Data Base Management System
 * 
 * Copyright (c) 1988 Regents of the University of California
 * 
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for educational, research, and non-profit purposes and
 * without fee is hereby granted, provided that the above copyright
 * notice appear in all copies and that both that copyright notice and
 * this permission notice appear in supporting documentation, and that
 * the name of the University of California not be used in advertising
 * or publicity pertaining to distribution of the software without
 * specific, written prior permission.  Permission to incorporate this
 * software into commercial products can be obtained from the Campus
 * Software Office, 295 Evans Hall, University of California, Berkeley,
 * Ca., 94720 provided only that the the requestor give the University
 * of California a free licence to any derived software for educational
 * and research purposes.  The University of California makes no
 * representations about the suitability of this software for any
 * purpose.  It is provided "as is" without express or implied warranty.
 * 
 */



/*
d11 1
a11 1
RcsId("$Header: tim.c,v 1.1 88/11/11 16:35:36 postgres Exp $");
@
