File:  [Research Unix] / researchv10no / cmd / spitbol / getdate.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

/*
 *	getdate.c -- fill a buffer with the date and time
 */

#include <time.h>

getdate (p)

char *p;

{
	long	tod;
	register struct	tm *tm;
	struct	tm *localtime();

	time (&tod);
	tm = localtime (&tod);

	conv (p, tm->tm_mon+1);
	p[2] = '/';
	conv (p+3, tm->tm_mday);
	p[5] = '/';
	conv (p+6, tm->tm_year);
	p[8] = ' ';
	conv (p+9, tm->tm_hour);
	p[11] = '.';
	conv (p+12, tm->tm_min);
	p[14] = '.';
	conv (p+15, tm->tm_sec);
}

static
conv (dest, value)

register char *dest;
register int value;

{
	dest[1] = value % 10 + '0';
	dest[0] = value / 10 + '0';
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.