当前位置: 首页>>代码示例>>C++>>正文


C++ DateTime::GetTime方法代码示例

本文整理汇总了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;
}
开发者ID:iRail,项目名称:BeTrains.Bada,代码行数:28,代码来源:Utils.cpp

示例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();
}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:8,代码来源:DateTime.cpp

示例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);
//.........这里部分代码省略.........
开发者ID:gigamegawatts,项目名称:GalileoWeatherReport,代码行数:101,代码来源:Main.cpp


注:本文中的DateTime::GetTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。