本文整理汇总了C++中TimeSpan::GetHours方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeSpan::GetHours方法的具体用法?C++ TimeSpan::GetHours怎么用?C++ TimeSpan::GetHours使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeSpan
的用法示例。
在下文中一共展示了TimeSpan::GetHours方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetRelativeTimeFromTimeStamp
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;
}
示例2: formatDelay
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;
}
示例3: formatTime
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;
}