本文整理汇总了C++中poco::DateTime::millisecond方法的典型用法代码示例。如果您正苦于以下问题:C++ DateTime::millisecond方法的具体用法?C++ DateTime::millisecond怎么用?C++ DateTime::millisecond使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类poco::DateTime
的用法示例。
在下文中一共展示了DateTime::millisecond方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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;
}
示例3: main
int main()
{
Poco::DateTime now;
char szClientName[256] = { 0, };
sprintf_s(szClientName, 256 - 1, "(%d-%d)", now.second(), now.millisecond());
std::cout << "clinet(" << szClientName << ") 서버에 연결 시도..." << std::endl;
Poco::Net::StreamSocket ss;
try
{
ss.connect(Poco::Net::SocketAddress("localhost", PORT));
for (int i = 0; i < 7; ++i)
{
char szMessage[256] = { 0, };
sprintf_s(szMessage, 256 - 1, "%d, Send Message From %s", i, szClientName);
auto nMsgLen = (int)strnlen_s(szMessage, 256 - 1);
ss.sendBytes(szMessage, nMsgLen);
std::cout << "서버에 보낸 메시지: " << szMessage << std::endl;
char buffer[256] = { 0, };
auto len = ss.receiveBytes(buffer, sizeof(buffer));
if (len <= 0)
{
std::cout << "서버와 연결이 끊어졌습니다" << std::endl;
break;
}
std::cout << "서버로부터 받은 메시지: " << buffer << std::endl;
Poco::Thread::sleep(256);
}
ss.close();
}
catch (Poco::Exception& exc)
{
std::cout << "서버 접속 실패: " << exc.displayText() << std::endl;
}
getchar();
return 0;
}
示例4: 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;
}
示例5: 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("");
}