#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "..\stdinc\time.h"

_LL_GETTIME(struct tm *tm2)
{
	time_t t = time(0);
	*tm2 = *localtime(&t);
}
_LL_TICKS()
{
	return 0;
}
time_t MKTIME(struct tm *a);
struct tm* GMTIME(time_t *t);
struct tm* LOCALTIME(time_t *t);
char *ASCTIME(struct tm *t);
char *CTIME(time_t *t);

void query(char *string, int *val)
{
	char istring[100];
	printf("\n%s? ",string);
	gets(istring);
	*val = atoi(istring);
}
void main(void)
{
	time_t t,t1;
	struct tm a,b,c;
	char buf[100],buf2[100];
	printf("%d\n",0x7fffffff/86400/365+70);
	while (1) {
		query("sec",&a.tm_sec);
		query("min",&a.tm_min);
		query("hr",&a.tm_hour);
		query("month",&a.tm_mon);
		query("day",&a.tm_mday);
		query("year",&a.tm_year);
		t = MKTIME(&a);
		t1 = mktime(&a);
		printf("MKTIME: %d %d\n",t,t1);
		t1 = TIME(0);
		strcpy(buf,CTIME(&t));
		strcpy(buf2,CTIME(&t1));
		printf("CTIME: %s %s\n",buf,buf2);
		b = *GMTIME(&t);
		c = *gmtime(&t);
		strcpy(buf,ASCTIME(&b));
		strcpy(buf2,ASCTIME(&c));
		printf("GMTIME: %s %s",buf,buf2);
		b = *LOCALTIME(&t);
		c = *localtime(&t);
		strcpy(buf,ASCTIME(&b));
		strcpy(buf2,ASCTIME(&c));
		printf("LOTIME: %s %s",buf,buf2);
	}
}