本文整理汇总了C++中DateTime::GetTime方法的典型用法代码示例。如果您正苦于以下问题:C++ DateTime::GetTime方法的具体用法?C++ DateTime::GetTime怎么用?C++ DateTime::GetTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTime
的用法示例。
在下文中一共展示了DateTime::GetTime方法的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: ToString
core::string DateTime::ToString(const DateTime& dt)
{
std::ostringstream stream;
stream << dt.GetDate().GetDay() << mT("/") << dt.GetDate().GetMonth() << mT("/") << dt.GetDate().GetYear();
stream << "-";
stream << dt.GetTime().GetHour() << mT(":") << dt.GetTime().GetMinute() << mT(":") << dt.GetTime().GetSecond();
return stream.str();
}
示例3: loop
// the loop routine runs over and over again forever:
void loop()
{
int result;
#ifdef USE_DHT22_SERIAL
getTempAndHumidityFromSerial();
#endif
// HACK - reset the matrix after every 100 loops - in case 7219s get confused
if (loop_count >= MATRIX_RESET_FREQUENCY)
{
if (WRITE_TO_SERIAL == 0)
{
m.init();
m.setIntensity(1);
}
loop_count = 0;
}
else
{
loop_count += 1;
}
double avgValue;
int offset;
// read local sensors
if (millis() - last_reading_millis >= MEASUREMENT_INTERVAL
// check if millis has looped back to 0
|| (millis() < last_reading_millis))
{
total_readings += 1;
// not supported on Galileo2 yet
//total_cpu_temp += readCPUTemp();
#ifdef USE_BMP085
bmptemp = bmp.readTemperature();
total_bmp085_temp += bmptemp;
bmppress = bmp.readPressure();
bmppressK = bmppress / (double)1000;
total_bmp085_pressure += bmppressK;
Log("bmp085 temp = %.2f press = %.1f\r\n", bmptemp, bmppressK);
#endif
#ifdef USE_TH02
th02temp = TH02.ReadTemperature();
total_th02_temp += th02temp;
th02hum = TH02.ReadHumidity();
total_th02_humidity += th02hum;
Log("TH02 temp = %.1fC humidity = %.1f%%\r\n", th02temp, th02hum);
#endif
last_reading_millis = millis();
}
// read online APIs
if (weather != nullptr && (millis() - last_weather_millis >= WEATHER_MEASUREMENT_INTERVAL
// check if millis has looped back to 0
|| (millis() < last_weather_millis)))
{
result = weather->GetCurrent();
Log("weather->GetCurrent returned %d\r\n", result);
if (result == 0)
{
last_weather_millis = millis();
}
}
if (weather != nullptr && (millis() - last_forecast_millis >= FORECAST_MEASUREMENT_INTERVAL
// check if millis has looped back to 0
|| (millis() < last_forecast_millis)))
{
result = weather->GetForecast();
Log("weather->GetForecast returned %d\r\n", result);
if (result == 0)
{
last_forecast_millis = millis();
}
}
// fill the data buffer with 00s
//memset(matrixData, 0, sizeof(matrixData));
// put date and time in buffer
offset = 0;
column = 0;
if (WRITE_TO_SERIAL >= 1)
{
// add prefix expected by Arduino code
offset += sprintf_s(matrixData + offset, MATRIX_DATA_LEN - offset, "D0:");
}
// write time to LED matrix
offset += dt.GetTime(matrixData + offset, MATRIX_DATA_LEN - offset, false, false);
//.........这里部分代码省略.........