コード例 #1
0
static
void GetFormatedDateTimeString (const XBOX::VTime& inTime, XBOX::VString &outDateTimeString)
{
	sLONG8 ms = inTime.GetMilliseconds() - (inTime.GetJulianDay() * 24 * 60 * 60 * 1000);

	outDateTimeString.Clear();
	outDateTimeString.Printf ("D%04d%02d%02dT%08d",
		inTime.GetLocalYear(),
		inTime.GetLocalMonth(),
		inTime.GetLocalDay(),
		ms);
}
コード例 #2
0
void VHTTPServerLog::_GetCurrentFormatedTime (XBOX::VString& outTimeString, bool inLocalTime)
{
	sWORD		year, month, day, hour, minute, seconds, milliseconds;
	XBOX::VTime	time;
	
	time.FromSystemTime();	// GMT time
	if (inLocalTime)
		time.GetLocalTime (year, month, day, hour, minute, seconds, milliseconds);
	else
		time.GetUTCTime (year, month, day, hour, minute, seconds, milliseconds);
	
	outTimeString.Clear();
	outTimeString.Printf ("%02d:%02d:%02d", hour, minute, seconds);
}
コード例 #3
0
void VHTTPServerLog::_GetCurrentFormatedDate (XBOX::VString& outDateString, bool inLocalTime, const char inDateSeparator)
{
	sWORD		year, month, day, hour, minute, seconds, milliseconds;
	XBOX::VTime	time;
	
	time.FromSystemTime();	// GMT time
	if (inLocalTime)
		time.GetLocalTime (year, month, day, hour, minute, seconds, milliseconds);
	else
		time.GetUTCTime (year, month, day, hour, minute, seconds, milliseconds);
	
	outDateString.Clear();
	outDateString.Printf ("%04d%c%02d%c%02d %02d:%02d:%02d",	year, inDateSeparator,
																month, inDateSeparator, day,
																hour, minute, seconds);
}
コード例 #4
0
void VHTTPServerLog::_MakeDateString (const XBOX::VTime& inTime, XBOX::VString& outDateString)
{
	/*	See description: http://httpd.apache.org/docs/2.2/logs.html#common

	[day/month/year:hour:minute:second zone]
	day = 2*digit
	month = 3*letter
	year = 4*digit
	hour = 2*digit
	minute = 2*digit
	second = 2*digit
	zone = (`+' | `-') 4*digit
	*/

	sWORD			year = 0, month = 0, day = 0, hour = 0, minute = 0, seconds = 0, milliseconds = 0;
	static sLONG	sGMTOffSet = 0;
	static bool		sGMTOffSetUndefined = true;

	inTime.GetUTCTime (year, month, day, hour, minute, seconds, milliseconds);

	if (sGMTOffSetUndefined)
	{
		sGMTOffSet = (XBOX::VSystem::GetGMTOffset (true) / (3600));
		sGMTOffSetUndefined = false;
	}

	outDateString.Clear();
	outDateString.Printf (	"%02d/%s/%04d:%02d:%02d:%02d %c%02ld00",
		day,
		CONST_ABBREVIATED_ENGLISH_MONTH_NAMES[month],
		year,
		hour,
		minute,
		seconds,
		(sGMTOffSet >= 0) ? '+' : '-',
		sGMTOffSet);
}