本文整理汇总了C++中FramePtr::getNano方法的典型用法代码示例。如果您正苦于以下问题:C++ FramePtr::getNano方法的具体用法?C++ FramePtr::getNano怎么用?C++ FramePtr::getNano使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FramePtr
的用法示例。
在下文中一共展示了FramePtr::getNano方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
USING_YJJ_NAMESPACE
/**
* entrance for journal tool
*/
int main(int argc, const char* argv[])
{
options_description desc{"Options"};
string format("%Y%m%d-%H:%M:%S");
desc.add_options()
("help,h", "Help screen")
("folder,f", value<string>(), "Journal Folder")
("name,n", value<string>(), "Journal Name")
("page,p", "Just Page Header")
("verify,v", "Verify hash code")
("keep,k", "keep listening")
("time,t", "time visualized")
("detail,d", "data details")
("current,c", "start from current")
("length,l", value<int>()->default_value(20), "Char num of frame data to print")
("msgtype,m", value<string>()->default_value(""), "Message type printed, -eg: -m 10,11")
("rmsgtype,r", value<string>()->default_value(""), "Message type not printed, -eg: -r 10,11")
("start_time,s", value<string>()->default_value("20000101-13:30:00"), "start time (%Y%m%d-%H:%M:%S)")
("end_time,e", value<string>()->default_value("20200101-00:00:00"), "end time (%Y%m%d-%H:%M:%S)");
variables_map vm;
store(parse_command_line(argc, argv, desc), vm);
notify(vm);
if (vm.count("help"))
{
std::cout << desc << '\n';
std::cout << "----frame tags----" << std::endl;
std::cout << " (st): status" << std::endl;
std::cout << " (so): source" << std::endl;
std::cout << " (na): nano time" << std::endl;
std::cout << " (en): extra nano time" << std::endl;
std::cout << " (vn): visualized nano (-t only)" << std::endl;
std::cout << " (fl): frame length" << std::endl;
std::cout << " (dl): data length" << std::endl;
std::cout << " (hl): header length" << std::endl;
std::cout << " (hs): hash code" << std::endl;
std::cout << " (mt): msg type" << std::endl;
std::cout << " (lf): last flag" << std::endl;
std::cout << " (id): request id" << std::endl;
std::cout << " (er): error id" << std::endl;
std::cout << " (em): error message" << std::endl;
std::cout << " (cn): data content" << std::endl;
std::cout << std::endl;
std::cout << "----page tags----" << std::endl;
std::cout << " (ST): page status" << std::endl;
std::cout << " (JN): journal name" << std::endl;
std::cout << " (PN): page number" << std::endl;
std::cout << " (FN): total number of frame in this page" << std::endl;
std::cout << " (LP): last position" << std::endl;
std::cout << " (FV): frame version" << std::endl;
std::cout << " (SN): start nano" << std::endl;
std::cout << " (CN): close nano" << std::endl;
return 0;
}
string start_time = vm.count("current") ? parseNano(getNanoTime(), format.c_str()) : vm["start_time"].as<string>();
if (vm.count("start_time"))
{
std::cout << "StartTime:\t" << start_time << std::endl;
}
if (vm.count("end_time"))
{
std::cout << "EndTime:\t" << vm["end_time"].as<string>() << std::endl;
}
if (vm.count("folder"))
{
std::cout << "Folder:\t" << vm["folder"].as<string>() << std::endl;
}
if (vm.count("name"))
{
std::cout << "ShortName:\t" << vm["name"].as<string>() << std::endl;
}
string folder = vm["folder"].as<string>();
string jname = vm["name"].as<string>();
if (vm.count("page"))
{
vector<short> pageNums = PageUtil::GetPageNums(folder, jname);
for (size_t idx = 0; idx < pageNums.size(); idx++)
{
PageHeader header = PageUtil::GetPageHeader(folder, jname, pageNums[idx]);
std::cout << "[" << pageNums[idx] << "]"
<< " (ST)" << (short)header.status
<< " (JN)" << header.journal_name
<< " (PN)" << header.page_num
<< " (FN)" << header.frame_num
<< " (LP)" << header.last_pos
<< " (FV)" << header.frame_version
<< " (SN)" << header.start_nano << "[" << parseNano(header.start_nano, format.c_str()) << "]"
<< " (CN)" << header.close_nano << "[" << parseNano(header.close_nano, format.c_str()) << "]";
std::cout << std::endl;
}
}
//.........这里部分代码省略.........