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


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

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


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

示例1: startElement

	void ForecastParser::startElement(const Poco::XML::XMLString& namespaceURI, const Poco::XML::XMLString& localName, const Poco::XML::XMLString& qname,
			const Poco::XML::Attributes& attributes) {

		static std::map <int, int> hmap = hourMap();

		if (localName == "time"){
			int tz = 0;
			data.dateStr =  attributes.getValue("", "from");
			std::cout << data.dateStr << std::endl;
			Poco::DateTime dt;
			Poco::DateTimeParser::parse(data.dateStr, dt, tz);
			data.date = Poco::DateTime(
					dt.year(),
					dt.month(),
					dt.day(),
					hmap[dt.hour()]
			);
		}
		if (localName == "temperature"){
			data.temperature = Poco::NumberParser::parse(attributes.getValue("", "value"));
		}
		if (localName == "symbol"){
			data.img = Poco::NumberParser::parse(attributes.getValue("", "number"));
			data.info = attributes.getValue("", "name");
		}
		if (localName == "windSpeed"){
			data.wind = Poco::NumberParser::parseFloat(attributes.getValue("", "mps"));
		}
		if (localName == "precipitation"){
			data.precipitation = Poco::NumberParser::parseFloat(attributes.getValue("", "value"));
		}
	}
开发者ID:hadzim,项目名称:bb,代码行数:32,代码来源:ForecastParser.cpp

示例2: toStr

	string HRCReport::toStr(const Poco::DateTime& date) const{
            std::ostringstream ostr;
			string sDate;
			ostr << date.day() << "/" << date.month() << "/" << date.year();
			sDate = ostr.str();
			return sDate;
	}
开发者ID:tsela85,项目名称:SplAssignment2,代码行数:7,代码来源:HRCReport.cpp

示例3: PopulateIDList

void InactiveIdentityRequester::PopulateIDList()
{
	Poco::DateTime weekago;
	int id;
	int count=0;
	SQLite3DB::Transaction trans(m_db);

	weekago-=Poco::Timespan(7,0,0,0,0);
	weekago.assign(weekago.year(),weekago.month(),weekago.day(),0,0,0);

	// only selects, deferred OK
	trans.Begin();

	// select identities we want to query (haven't seen yet today) - sort by their trust level (descending) with secondary sort on how long ago we saw them (ascending)
	SQLite3DB::Statement st=m_db->Prepare("SELECT IdentityID FROM tblIdentity WHERE PublicKey IS NOT NULL AND PublicKey <> '' AND LastSeen IS NOT NULL AND LastSeen<? AND tblIdentity.FailureCount<=(SELECT OptionValue FROM tblOption WHERE Option='MaxFailureCount') AND (PurgeDate IS NULL OR PurgeDate>datetime('now')) ORDER BY RANDOM();");
	st.Bind(0, Poco::DateTimeFormatter::format(weekago,"%Y-%m-%d %H:%M:%S"));
	trans.Step(st);

	m_ids.clear();

	while(st.RowReturned())
	{
		st.ResultInt(0,id);
		m_ids[std::pair<long,long>(count,id)].m_requested=false;
		trans.Step(st);
		count+=1;
	}

	trans.Finalize(st);
	trans.Commit();
}
开发者ID:steveatinfincia,项目名称:fms,代码行数:31,代码来源:inactiveidentityrequester.cpp

示例4: CheckForNeededInsert

void TrustListInserter::CheckForNeededInsert()
{
	Poco::DateTime date;
	int currentday=date.day();
	date-=Poco::Timespan(0,6,0,0,0);
	// insert trust lists every 6 hours - if 6 hours ago was different day then set to midnight of current day to insert list today ASAP
	if(currentday!=date.day())
	{
		date.assign(date.year(),date.month(),currentday,0,0,0);
	}

	SQLite3DB::Statement st=m_db->Prepare("SELECT LocalIdentityID, PrivateKey FROM tblLocalIdentity WHERE tblLocalIdentity.Active='true' AND PrivateKey IS NOT NULL AND PrivateKey <> '' AND PublishTrustList='true' AND InsertingTrustList='false' AND (LastInsertedTrustList<=? OR LastInsertedTrustList IS NULL);");
	st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S"));
	st.Step();

	if(st.RowReturned())
	{
		int lid=0;
		std::string pkey("");
		st.ResultInt(0,lid);
		st.ResultText(1,pkey);
		StartInsert(lid,pkey);
	}

}
开发者ID:SeekingFor,项目名称:FMS,代码行数:25,代码来源:trustlistinserter.cpp

示例5: GetSolarNoon

Poco::DateTime CSunRiseSet::GetSolarNoon(double dLon, Poco::DateTime time) 
{ 
	bool bLeap = IsLeapYear(time.year()); 
	 
	int iJulianDay = CalcJulianDay(time.month(),time.day(),bLeap); 
 
	double timeGMT = calcSolNoonGMT(iJulianDay, dLon);  
 
	double dHour = timeGMT / 60; 
	int iHour = (int)dHour; 
	double dMinute = 60 * (dHour - iHour); 
	int iMinute = (int)dMinute; 
	double dSecond = 60 * (dMinute - iMinute); 
	int iSecond = (int)dSecond; 
	 
	Poco::DateTime NewTime(time.year(),time.month(),time.day(),iHour,iMinute,iSecond); 
	NewTime.makeLocal(Poco::Timezone::tzd() - Poco::Timezone::dst()); 
	return NewTime;
} 
开发者ID:leomeyer,项目名称:OPDI,代码行数:19,代码来源:SunRiseSet.cpp

示例6: dateTimeSync

void Utility::dateTimeSync(SQL_TIMESTAMP_STRUCT& ts, const Poco::DateTime& dt)
{
	ts.year = dt.year();
	ts.month = dt.month();
	ts.day = dt.day();
	ts.hour = dt.hour();
	ts.minute = dt.minute();
	ts.second = dt.second();
	// Fraction support is limited to milliseconds due to MS SQL Server limitation
	// see http://support.microsoft.com/kb/263872
	ts.fraction = (dt.millisecond() * 1000000);// + (dt.microsecond() * 1000);
}
开发者ID:lilinghui,项目名称:poco,代码行数:12,代码来源:Utility.cpp

示例7: GetSunrise

Poco::DateTime CSunRiseSet::GetSunrise(double dLat,double dLon, Poco::DateTime time) 
{ 
	bool bLeap = IsLeapYear(time.year()); 
	 
	int iJulianDay = CalcJulianDay(time.month(),time.day(),bLeap); 
 
	double timeGMT = calcSunriseGMT(iJulianDay, dLat,dLon);  
 
 
	// if Northern hemisphere and spring or summer, use last sunrise and next sunset 
	if ((dLat > 66.4) && (iJulianDay > 79) && (iJulianDay < 267)) 
		timeGMT = findRecentSunrise(iJulianDay, dLat, dLon); 
	// if Northern hemisphere and fall or winter, use next sunrise and last sunset 
	else if ((dLat > 66.4) && ((iJulianDay < 83) || (iJulianDay > 263))) 
		timeGMT = findNextSunrise(iJulianDay, dLat, dLon); 
	// if Southern hemisphere and fall or winter, use last sunrise and next sunset 
	else if((dLat < -66.4) && ((iJulianDay < 83) || (iJulianDay > 263))) 
		timeGMT = findRecentSunrise(iJulianDay, dLat, dLon); 
	// if Southern hemisphere and spring or summer, use next sunrise and last sunset 
	else if((dLat < -66.4) && (iJulianDay > 79) && (iJulianDay < 267)) 
		timeGMT = findNextSunrise(iJulianDay, dLat, dLon); 
//	else  
//	{ 
		//("Unaccountable Missing Sunrise!"); 
//	} 
	 
	 
	double dHour = timeGMT / 60; 
	int iHour = (int)dHour; 
	double dMinute = 60 * (dHour - iHour); 
	int iMinute = (int)dMinute; 
	double dSecond = 60 * (dMinute - iMinute); 
	int iSecond = (int)dSecond; 
	 
	Poco::DateTime NewTime(time.year(),time.month(),time.day(),iHour,iMinute,iSecond); 
	NewTime.makeLocal(Poco::Timezone::tzd() - Poco::Timezone::dst()); 
	return NewTime;
} 
开发者ID:leomeyer,项目名称:OPDI,代码行数:38,代码来源:SunRiseSet.cpp

示例8: GenTick

    CThostFtdcDepthMarketDataField* Exchange::GenTick()
    {
        Poco::DateTime now;
        string date = Poco::format("%02d%02d%02d", now.year(), now.month(), now.day());
        string time = Poco::format("%02d:%02d:%02d", now.hour(), now.minute(), now.second());

        strcpy(tick->TradingDay, date.c_str());
        strcpy(tick->UpdateTime, time.c_str());
        strcpy(tick->InstrumentID, INSTRUMENT);
        tick->UpdateMillisec = now.millisecond();
        tick->LastPrice = RandomWalk(tick->LastPrice);
        tick->Volume = tick->Volume;
        return tick;
    }
开发者ID:Ainstain,项目名称:pheux,代码行数:14,代码来源:Exchange.cpp

示例9: updateSunPosition

void ofApp::updateSunPosition(){
    Poco::DateTime now; //UTC
	ofLogVerbose() << "updating sun position :";
	ofLogVerbose() << now.day() << " " << now.month() << " " << now.year() << " " << now.hour() << " " << now.minute();

	cTime ctime;
	ctime.iYear = now.year();
	ctime.iMonth = now.month();
	ctime.iDay = now.day();
	ctime.dHours = now.hour(); //UTC
	ctime.dMinutes = now.minute();
	ctime.dSeconds = now.second();

	cLocation location;
	location.dLatitude = Manager.myCoordinates.getLatitude();
	location.dLongitude = Manager.myCoordinates.getLongitude();
	ofVec2f data = sunpos(ctime, location, &sunCalc);

    double angle = 15 * (ctime.dHours + ctime.dMinutes/60);  //convert time to angle
    sunCoordinates.x = ofMap(angle, 0, 360, 180, -180);      //map angle to longitude
	sunCoordinates.y =  -data.y *180/PI;	                 //inclination of earth - convert from rad to degrees and invert

	ofLogVerbose() << "sun coordinates: longitude " << sunCoordinates.x << " / latitude:" << sunCoordinates.y;
}
开发者ID:antoniohof,项目名称:android-orbital-tracker,代码行数:24,代码来源:ofApp.cpp

示例10: dump

    void TextSerializer::dump()
    {
        if (buffer.size() == 0)
            return;

        Poco::DateTime date = buffer[0]->DateTime;
        string file = Poco::format("%s/%04d%02d%02d.csv", path, date.year(), date.month(), date.day());

        std::ofstream os;
        os.open (file, std::ofstream::out | std::ofstream::app);

        for (int i = 0; i < buffer.size(); i++)
            os << serTick(buffer[i]);

        os << std::flush;
        os.close();
    }
开发者ID:Ainstain,项目名称:pheux,代码行数:17,代码来源:TextSerializer.cpp

示例11: prefix

    char* prefix(char* buffer, const std::size_t len, const char* level)
    {
        const char *threadName = Util::getThreadName();
#ifdef __linux
        const long osTid = Util::getThreadId();
#elif defined IOS
        const auto osTid = pthread_mach_thread_np(pthread_self());
#endif
        Poco::DateTime time;
        snprintf(buffer, len, "%s-%.05lu %.4u-%.2u-%.2u %.2u:%.2u:%.2u.%.6u [ %s ] %s  ",
                    (Source.getInited() ? Source.getId().c_str() : "<shutdown>"),
                    osTid,
                    time.year(), time.month(), time.day(),
                    time.hour(), time.minute(), time.second(),
                    time.millisecond() * 1000 + time.microsecond(),
                    threadName, level);
        return buffer;
    }
开发者ID:LibreOffice,项目名称:online,代码行数:18,代码来源:Log.cpp

示例12: DisplayDateTime

//----------------------------------------
//	DisplayDateTime
//----------------------------------------
void DisplayDateTime(const Poco::DateTime& dateTime, ScopedLogMessage& msg)
{
	msg.Message(Poco::format("            year = %d", dateTime.year()));
	msg.Message(Poco::format("           month = %d\t(1 to 12)", dateTime.month()));
	msg.Message(Poco::format("             day = %d\t(1 to 31)", dateTime.day()));
	msg.Message(Poco::format("            hour = %d\t(0 to 23)", dateTime.hour()));
	msg.Message(Poco::format("          minute = %d\t(0 to 59)", dateTime.minute()));
	msg.Message(Poco::format("          second = %d\t(0 to 59)", dateTime.second()));
	msg.Message(Poco::format("     millisecond = %d\t(0 to 999)", dateTime.millisecond()));
	msg.Message(Poco::format("     microsecond = %d\t(0 to 999)", dateTime.microsecond()));
	msg.Message(Poco::format("            isAM = %s\t(true or false)", std::string(dateTime.isAM() ? "true":"false")));
	msg.Message(Poco::format("            isPM = %s\t(true or false)", std::string(dateTime.isPM() ? "true":"false")));
	msg.Message(Poco::format("      isLeapYear = %s\t(true or false)", std::string(Poco::DateTime::isLeapYear(dateTime.year()) ? "true":"false")));
	msg.Message(Poco::format("        hourAMPM = %d\t(0 to 12)", dateTime.hourAMPM()));
	msg.Message(Poco::format("       dayOfWeek = %d\t(0 to 6,   0: Sunday)", dateTime.dayOfWeek()));
	msg.Message(Poco::format("       dayOfYear = %d\t(1 to 366, 1: January 1)", dateTime.dayOfYear()));
	msg.Message(Poco::format("     daysOfMonth = %d\t(1 to 366, 1: January 1)", Poco::DateTime::daysOfMonth(dateTime.year(), dateTime.month())));
	msg.Message(Poco::format("            week = %d\t(0 to 53,  1: the week containing January 4)", dateTime.week()));

	msg.Message("");
}
开发者ID:schidler,项目名称:MeCloud,代码行数:24,代码来源:DateTimeTest.cpp

示例13: parseBSD

void SyslogParser::parseBSD(const std::string& msg, RemoteSyslogChannel::Severity severity, RemoteSyslogChannel::Facility fac, std::size_t& pos)
{
	Poco::Message::Priority prio = convert(severity);
	// rest of the unparsed header is:
	// "%b %f %H:%M:%S" SP hostname|ipaddress
	// detect three spaces
	int spaceCnt = 0;
	std::size_t start = pos;
	while (spaceCnt < 3 && pos < msg.size())
	{
		if (msg[pos] == ' ')
		{
			spaceCnt++;
			if (spaceCnt == 1)
			{
				// size must be 3 chars for month
				if (pos - start != 3)
				{
					// probably a shortened time value, or the hostname
					// assume hostName
					Poco::Message logEntry(msg.substr(start, pos-start), msg.substr(pos+1), prio);
					_pListener->log(logEntry);
					return;
				}
			}
			else if (spaceCnt == 2)
			{
				// a day value!
				if (!(std::isdigit(msg[pos-1]) && (std::isdigit(msg[pos-2]) || std::isspace(msg[pos-2]))))
				{
					// assume the next field is a hostname
					spaceCnt = 3;
				}
			}
			if (pos + 1 < msg.size() && msg[pos+1] == ' ')
			{
				// we have two spaces when the day value is smaller than 10!
				++pos; // skip one
			}
		}
		++pos;
	}
	std::string timeStr(msg.substr(start, pos-start-1));
	int tzd(0);
	Poco::DateTime date;
	int year = date.year(); // year is not included, use the current one
	bool hasDate = Poco::DateTimeParser::tryParse(RemoteSyslogChannel::BSD_TIMEFORMAT, timeStr, date, tzd);
	if (hasDate)
	{
		int m = date.month();
		int d = date.day();
		int h = date.hour();
		int min = date.minute();
		int sec = date.second();
		date = Poco::DateTime(year, m, d, h, min, sec);
	}
	// next entry is host SP
	std::string hostName(parseUntilSpace(msg, pos));

	// TAG: at most 32 alphanumeric chars, ANY non alphannumeric indicates start of message content
	// ignore: treat everything as content
	std::string message(msg.substr(pos));
	pos = msg.size();
	Poco::Message logEntry(hostName, message, prio);
	logEntry.setTime(date.timestamp());
	_pListener->log(logEntry);
}
开发者ID:carvalhomb,项目名称:tsmells,代码行数:67,代码来源:RemoteSyslogListener.cpp

示例14: convert

	void convert(const std::string& path)
	{
		Poco::Path p(path);
		Poco::Path op(path);
		if (_output.empty())
		{
			op.setExtension("cpsp");
		}
		else
		{
			op = _output;
		}
		if (_contentType.empty())
		{
			_contentType = extToContentType(p.getExtension());
		}
		if (_clazz.empty())
		{
			_clazz = p.getBaseName();
		}
		Poco::FileInputStream istr(path);
		Poco::FileOutputStream ostr(op.toString());
		ostr << "<%@ page\n"
		     << "    contentType=\"" << _contentType << "\"\n"
		     << "    form=\"false\"\n"
		     << "    namespace=\"" << _namespace << "\"\n"
		     << "    class=\"" << _clazz << "\"\n"
		     << "    precondition=\"checkModified(request)\"%><%@"
		     << "    impl include=\"Poco/DateTime.h\"\n"
		     << "         include=\"Poco/DateTimeParser.h\"\n"
		     << "         include=\"Poco/DateTimeFormatter.h\"\n"
		     << "         include=\"Poco/DateTimeFormat.h\"%><%!\n\n";
		ostr << "// " << path << "\n";
		ostr << "static const unsigned char data[] = {\n\t";
		int ch = istr.get();
		int pos = 0;
		while (ch != -1)
		{
			ostr << "0x" << NumberFormatter::formatHex(ch, 2) << ", ";
			if (pos++ == 16)
			{
				ostr << "\n\t";
				pos = 0;
			}
			ch = istr.get();
		}
		Poco::File f(path);
		Poco::DateTime lm = f.getLastModified();
		ostr << "\n};\n\n\n";
		ostr << "static bool checkModified(Poco::Net::HTTPServerRequest& request)\n"
		     << "{\n"
		     << "\tPoco::DateTime modified(" << lm.year() << ", " << lm.month() << ", " << lm.day() << ", " << lm.hour() << ", " << lm.minute() << ", " << lm.second() << ");\n"
		     << "\trequest.response().setChunkedTransferEncoding(false);\n"
		     << "\trequest.response().set(\"Last-Modified\", Poco::DateTimeFormatter::format(modified, Poco::DateTimeFormat::HTTP_FORMAT));\n"
		     << "\tif (request.has(\"If-Modified-Since\"))\n"
		     << "\t{\n"
		     << "\t\tPoco::DateTime modifiedSince;\n"
		     << "\t\tint tzd;\n"
		     << "\t\tPoco::DateTimeParser::parse(request.get(\"If-Modified-Since\"), modifiedSince, tzd);\n"
		     << "\t\tif (modified <= modifiedSince)\n"
		     << "\t\t{\n"
		     << "\t\t\trequest.response().setContentLength(0);\n"
		     << "\t\t\trequest.response().setStatusAndReason(Poco::Net::HTTPResponse::HTTP_NOT_MODIFIED);\n"
		     << "\t\t\trequest.response().send();\n"
		     << "\t\t\treturn false;\n"
		     << "\t\t}\n"
		     << "\t}\n"
		     << "\trequest.response().setContentLength(static_cast<int>(sizeof(data)));\n"
		     << "\treturn true;\n"
		     << "}\n"
			 << "%><%\n"
		     << "\tresponseStream.write(reinterpret_cast<const char*>(data), sizeof(data));\n"
		     << "%>";
	}
开发者ID:BrianHoldsworth,项目名称:Poco,代码行数:74,代码来源:File2Page.cpp


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