/******************************************************************************

	ZExCtB()

	This function implements the TECO ^B command,  which returns the
current date encoded in the following way:

		((year-1900)*16+month)*32+day

*****************************************************************************/

#include "ZPort.h"		/* define portability identifiers */
#include "DefTeco.h"		/* define general identifiers */



#ifdef UNKNOWN
DEFAULT ZExCtB()			/* return current date */
{
	return(ExeNYI());
}
#endif



#ifdef vax11c
#include ssdef		/* define system service status return identifiers */

VOID	lib$stop();	/* terminate image with stack dump */
DEFAULT	PushEx();	/* push onto expression stack */
int	sys$numtim();	/* VAX/VMS "get numeric time" system service */


DEFAULT ZExCtB()			/* return current date */
{
	int	status;
	short	system_time[7];
	LONG	teco_time;

#if DEBUGGING
DbgInd+=2;if(DbgLvl>=1){DbgMsg();DbgDBf("ZExCtB: called.\015\012");DbgROf();}
#endif
	status = sys$numtim(	system_time,	/* returned time */
				0);		/* time to convert */
	if (status != SS$_NORMAL)
		lib$stop(status);

	teco_time = (system_time[0] - 1900) << 4;	/* (year-1900) * 16 */
	teco_time += system_time[1];
	teco_time = teco_time << 5;			/* multiply by 32 */
	teco_time += system_time[2];

#if DEBUGGING
if(DbgLvl>=1)
{DbgMsg();DbgDBf("ZExCtB: returning PushEx().\015\012");DbgROf();}DbgInd-=2;
#endif
	return(PushEx(teco_time, OPERAND));
}
#endif



#ifdef XENIX
DEFAULT ZExCtB()			/* return current date */
{
	return(ExeNYI());
}
#endif
