/*!
@brief 時間関係ラッパー
*/
#define DKUTIL_TIME_C

#include <dkutil/time.hpp>
	
void WINAPI dkcGetCharOfTimeUpToMinute(char *buff,size_t buffsize,BOOL Sysflag)
{
	SYSTEMTIME lpSystemTime={0};
	if(Sysflag){
		GetSystemTime(
			&lpSystemTime   // address of system time structure
		);
	}else{
		GetLocalTime(&lpSystemTime);
	}
	_snprintf(buff,buffsize,"%d:%d %d/%d/%d",
		lpSystemTime.wHour,
		lpSystemTime.wMinute,
		lpSystemTime.wYear,
		lpSystemTime.wMonth,
		lpSystemTime.wDay
		);
		//10:47 2003/05/31
}
void WINAPI dkcGetCharOfMemoPadTypeTime(char *buff,size_t buffsize){
	dkcGetCharOfTimeUpToMinute(buff,buffsize,FALSE);
}

void WINAPI dkcGetCharOfSystemTimeAll(char *buff,size_t buffsize)
{
	SYSTEMTIME lpSystemTime;
	char *lpszDayOfWeek = NULL;

	DKUTIL_STRUCTURE_INIT(lpSystemTime);
	GetSystemTime(
		&lpSystemTime   // address of system time structure
	);

	//曜日文字列の作成
  switch (lpSystemTime.wDayOfWeek){
  case 0: lpszDayOfWeek = "Sun";   break;
  case 1: lpszDayOfWeek = "Mon";   break;
  case 2: lpszDayOfWeek = "Tue";   break;
  case 3: lpszDayOfWeek = "Wed";   break;
  case 4: lpszDayOfWeek = "Thu";   break;
  case 5: lpszDayOfWeek = "Fri";   break;
  case 6: lpszDayOfWeek = "Sat";   break;
  }   // 曜日文字列の作成
	_snprintf(buff,buffsize,"%d:%d:%d.%d %d/%d/%d/%s",
		lpSystemTime.wHour,
		lpSystemTime.wMinute,
		lpSystemTime.wSecond,
		lpSystemTime.wMilliseconds,
		lpSystemTime.wYear,
		lpSystemTime.wMonth,
		lpSystemTime.wDay,
		lpszDayOfWeek
		);
}

void WINAPI dkcGetCharOfLocalTimeAllJapanese(char *buff,size_t buffsize){
  SYSTEMTIME  time;           //時刻
  LPCSTR      lpszDayOfWeek;  //曜日

  //ローカル時間の取得
  GetLocalTime (&time);

  //曜日文字列の作成
  switch (time.wDayOfWeek){
  case 0: lpszDayOfWeek = "日";   break;
  case 1: lpszDayOfWeek = "月";   break;
  case 2: lpszDayOfWeek = "火";   break;
  case 3: lpszDayOfWeek = "水";   break;
  case 4: lpszDayOfWeek = "木";   break;
  case 5: lpszDayOfWeek = "金";   break;
  case 6: lpszDayOfWeek = "土";   break;
  }   // 曜日文字列の作成

  //文字列の書式か
  _snprintf(buff,buffsize,"%d年%d月%d日（%s曜日） %d時%d分%d.%d秒",
      time.wYear, time.wMonth, time.wDay, lpszDayOfWeek,
      time.wHour, time.wMinute, time.wSecond, time.wMilliseconds
  );

}











