#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <time.h>

extern int _osenv ;

int errno,_dos_errno;

struct tm *_ll_gettime(struct tm *tm2)
{
	SYSTEMTIME timex ;
	GetLocalTime(&timex) ;

  tm2->tm_sec = timex.wSecond;
  tm2->tm_min = timex.wMinute;
  tm2->tm_hour = timex.wHour;

  tm2->tm_mday = timex.wDay;
  tm2->tm_mon = timex.wMonth-1;
  tm2->tm_year = timex.wYear-1900;
	return tm2;
}
int _ll_ticks(void)
{
	SYSTEMTIME timex ;
	GetLocalTime(&timex);
	return timex.wMilliseconds ;
}
int _ll_getenv(char *buf, int id)
{
	int count = 0 ;
	int rv ;
	char *env = _osenv ;
	if (buf) {
		while (id--) {
			while (*env) env++ ;
			if (*++env == 0)
				return 0;
		}
		strcpy(buf,env) ;
		return (int)env ;
	} else {
		if (!*env)
			return 0 ;
		do {
			count++ ;
			while (*env) env++ ;
			env++ ;
		} while (*env) ;
		return count ;
	}
}	