本文整理汇总了C++中Monitor::GetTimestamp方法的典型用法代码示例。如果您正苦于以下问题:C++ Monitor::GetTimestamp方法的具体用法?C++ Monitor::GetTimestamp怎么用?C++ Monitor::GetTimestamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monitor
的用法示例。
在下文中一共展示了Monitor::GetTimestamp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
}
if ( mon_id > 0 )
{
Monitor *monitor = Monitor::Load( mon_id, function&(ZMU_QUERY|ZMU_ZONES), Monitor::QUERY );
if ( monitor )
{
if ( verbose )
{
printf( "Monitor %d(%s)\n", monitor->Id(), monitor->Name() );
}
if ( ! monitor->connect() ) {
Error( "Can't connect to capture daemon: %d %s", monitor->Id(), monitor->Name() );
exit( -1 );
}
char separator = ' ';
bool have_output = false;
if ( function & ZMU_STATE )
{
Monitor::State state = monitor->GetState();
if ( verbose )
printf( "Current state: %s\n", state==Monitor::ALARM?"Alarm":(state==Monitor::ALERT?"Alert":"Idle") );
else
{
if ( have_output ) printf( "%c", separator );
printf( "%d", state );
have_output = true;
}
}
if ( function & ZMU_TIME )
{
struct timeval timestamp = monitor->GetTimestamp( image_idx );
if ( verbose )
{
char timestamp_str[64] = "None";
if ( timestamp.tv_sec )
strftime( timestamp_str, sizeof(timestamp_str), "%Y-%m-%d %H:%M:%S", localtime( ×tamp.tv_sec ) );
if ( image_idx == -1 )
printf( "Time of last image capture: %s.%02ld\n", timestamp_str, timestamp.tv_usec/10000 );
else
printf( "Time of image %d capture: %s.%02ld\n", image_idx, timestamp_str, timestamp.tv_usec/10000 );
}
else
{
if ( have_output ) printf( "%c", separator );
printf( "%ld.%02ld", timestamp.tv_sec, timestamp.tv_usec/10000 );
have_output = true;
}
}
if ( function & ZMU_READ_IDX )
{
if ( verbose )
printf( "Last read index: %d\n", monitor->GetLastReadIndex() );
else
{
if ( have_output ) printf( "%c", separator );
printf( "%d", monitor->GetLastReadIndex() );
have_output = true;
}
}
if ( function & ZMU_WRITE_IDX )
{
if ( verbose )
printf( "Last write index: %d\n", monitor->GetLastWriteIndex() );