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


C++ LocalDateTime::year方法代码示例

本文整理汇总了C++中LocalDateTime::year方法的典型用法代码示例。如果您正苦于以下问题:C++ LocalDateTime::year方法的具体用法?C++ LocalDateTime::year怎么用?C++ LocalDateTime::year使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LocalDateTime的用法示例。


在下文中一共展示了LocalDateTime::year方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setDate

//----------------------------------------------------------------------------//
void AstmField::setDate(const LocalDateTime &val, const int &index, const int &repeatedIndex)
{
    char output[18];
    
#if defined(POCO_OS_FAMILY_WINDOWS)
    _snprintf_s(output, 16, "%04d%02d%02d", val.year(), val.month(), val.day());
#else
    snprintf(output, 16, "%04d%02d%02d", val.year(), val.month(), val.day());
#endif
    
    checkIndex(index, repeatedIndex, true);
    _items[index + repeatedIndex * _componentSize] = output;
}
开发者ID:AlekNS,项目名称:smitlab-service,代码行数:14,代码来源:AstmField.cpp

示例2: main

int main(int argc, char **argv)
{

	if (argc < 3)
	{
		cout << "Uage:" << argv[0] << " [ -f ] <src server > <save file >" << endl;
		exit(0);
	}

	signal(SIGHUP, sigroutine); //* 下面设置三个信号的处理方法
	signal(SIGINT, sigroutine);
	signal(SIGQUIT, sigroutine);

	bool dfps = false;
	int postion = 0;
	if (argc == 4 && (string(argv[1]) == string("-f")))
	{
		postion++;
		dfps = true;
	}

	NetH264Reader reader(argv[postion + 1]);
	FILE *out;

	cout << "connect server " << argv[postion + 1] << endl;
	if (reader.open())
	{
		cout << "connect server " << argv[postion + 1] << " sucess" << endl;
		out = fopen(argv[postion + 2], "wb");
		if (out)
		{

			H264NALU *nalu = 0;
			char naluHead[] =
			{ 0x0, 0x0, 0x0, 0x1 };
			int time = LocalDateTime().second();
			int fps = 0;
			while (run)
			{
				nalu = reader.readH264();
				if (nalu != 0)
				{
					if (dfps)
					{
						if (LocalDateTime().second() == time)
						{
							fps++;
						}
						else
						{
							LocalDateTime ld;
							cout << ld.year() << "-" << ld.month() << "-" << ld.day() << " " << ld.hour() << ":" << ld.minute() << ":" << ld.second() << " recevie fps:" << fps
									<< endl;
							fps = 1;
							time = LocalDateTime().second();
						}
					}
					fwrite(naluHead, 4, 1, out);
					fwrite(nalu->getData(), nalu->getLength(), 1, out);
				}
				else
				{
					cout << "disconnet server " << endl;
					break;
				}

			}
			
			fclose(out);
			out = NULL;
		}
		else
		{
			cout << "open file " << argv[postion + 2] << " error" << endl;
		}
	}
	else
	{
		cout << "connect server " << argv[postion + 1] << " fail" << endl;
	}

}
开发者ID:commshare,项目名称:live,代码行数:82,代码来源:vlsave.cpp


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