Exemplo n.º 1
0
void
Form2::SetTimer(void)
{
	long long tick ;

	// Get current tick value
	Tizen::Base::TimeSpan uptime(0);
	result r = Tizen::System::SystemTime::GetUptime(uptime);
	if (IsFailed(r))
	{
		AppLog("System uptime not available\n");
		return ;
	}
	tick = uptime.GetTicks();


	tick -= __startTick;
	TimeSpan span = static_cast<long>(tick);


	String __watchText;
	// Set StopWatch String
	__watchText.Clear();

	if(span.GetMinutes() < 10)
	{
		__watchText.Append("0");
	}
	__watchText.Append(span.GetMinutes());
	__watchText.Append(":");
	if(span.GetSeconds() < 10)
	{
		__watchText.Append("0");
	}
	__watchText.Append(span.GetSeconds());
	__watchText.Append(":");
	if(span.GetMilliseconds() / 10 < 10)
	{
		__watchText.Append("0");
	}
	__watchText.Append(span.GetMilliseconds() / 10);

	__pLabel2->SetText(__watchText);
	__pLabel2->Invalidate(false);
	__pLabel2->Show();

	return;
}
Exemplo n.º 2
0
String Utils::GetRelativeTimeFromTimeStamp(DateTime receivedTime)
{
	DateTime currentTime;
	//DateTime receivedTime;
	String relativeTime;
	int mins = 0;
	int hours = 0;
	int days = 0;

	SystemTime::GetCurrentTime(WALL_TIME, currentTime);
	//receivedTime = Utils::ConvertUtcTimeToStardardTime(timeStamp);

	TimeSpan timeDiff = (currentTime.GetTime() - receivedTime.GetTime());
	days = timeDiff.GetDays();
	hours = timeDiff.GetHours();
	mins = timeDiff.GetMinutes();
	if(days >= 1)
	{
		relativeTime.Format(20, L"%d days ago", days);
	}
	else if (hours > 0)
		relativeTime.Format(20, L"%dhr%dmin ago",hours, mins);

	else
		relativeTime.Format(20, L"%dmin ago", mins);

	return relativeTime;
}
Exemplo n.º 3
0
String Utils::formatDelay(TimeSpan delay){
	int hour = delay.GetHours();
	int min = delay.GetMinutes();
	if(min==0 && hour ==0)
		return L"";
	String time = L"+" + Integer::ToString(hour)+ L"H";
	if(min < 10) time += L"0";
	time += Integer::ToString(min);
	return time;
}
Exemplo n.º 4
0
String Utils::formatTime(TimeSpan duration){
	int hour = duration.GetHours();
	int min = duration.GetMinutes();
	String time;
	if(hour<10) time += L"0";
	time += Integer::ToString(hour)+ L":";
	if(min < 10) time += L"0";
	time += Integer::ToString(min);
	return time;
}