/*
 * dt.c --
 * 	Functions for the built-in type "dt".
 */

#include "tmp/c.h"

RcsId("/usr/local/devel/postgres-4.2-devel/src/backend/utils/adt/RCS/dt.c,v 1.8 1994/01/30 04:17:52 aoki Exp");

#include "utils/palloc.h"
#include "utils/builtins.h"


	    /* ========== USER I/O ROUTINES ========== */

/*
 *	dtin		- converts "nseconds" to internal representation
 *
 *	XXX Currently, just creates an integer.
 */
int32
dtin(datetime)
	char	*datetime;
{
	if (datetime == NULL)
		return((int32) 0);
	return((int32) atol(datetime));
}

/*
 *	dtout		- converts internal form to "..."
 *
 *	XXX assumes sign, 10 digits max, '\0'
 */
char *
dtout(datetime)
	int32	datetime;
{
	char		*result;

	result = (char *) palloc(12);
	Assert(result);
	ltoa(datetime, result);
	return(result);
}


	     /* ========== PUBLIC ROUTINES ========== */

	 /* (see int.c for comparison/operation routines) */


	     /* ========== PRIVATE ROUTINES ========== */

			     /* (none) */
