• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ printtime函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中printtime函数的典型用法代码示例。如果您正苦于以下问题:C++ printtime函数的具体用法?C++ printtime怎么用?C++ printtime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: printtime

void RaspiVoice::PlayFrame(RaspiVoiceOptions opt)
{
	if (opt.quit)
	{
		return;
	}

	if (!opt.mute)
	{
		AudioData &audioData = i2ssConverter->GetAudioData();
		audioData.CardNumber = opt.audio_card;
		audioData.Verbose = verbose;

		if (verbose)
		{
			printtime("Playing audio");
		}

		audioData.Play();

		if (opt.output_filename != "")
		{
			audioData.SaveToWavFile(opt.output_filename);
		}

		//audioData.PlayWav(FNAME);
	}
	else if (verbose)
	{
		printtime("Muted, not playing audio");
	}
}
开发者ID:aftersight,项目名称:After-Sight-Model-1,代码行数:32,代码来源:RaspiVoice.cpp


示例2: plong

void
plong(FTSENT *p)
{
    char tmp[NAME_BUFSZ];
    FTSENT_PRT *prt=(FTSENT_PRT*)p->fts_pointer;
    int length=prt->s_name;
    if (f_inodenum)
        printf("%*lld ", prt->s_inode, 
               (LL)p->fts_statp->st_ino);
    if (f_dispblock) {
        LL b=p->fts_statp->st_blocks;
        b/=block_size_factor;
        printf("%*lld ", prt->s_block, b);
    }
    printmodestr(p);
    printf("%*hd ", prt->s_link, (short)p->fts_statp->st_nlink);
    if (f_numric) {
        printf("%*d  ", prt->s_uid, (int)p->fts_statp->st_uid);
        printf("%*d  ", prt->s_gid, (int)p->fts_statp->st_gid);
    }
    else {
        if (printuname(p, prt->s_uname)==-1)
            printf("%*d  ", prt->s_uid, (int)p->fts_statp->st_uid);
        if (printgname(p, prt->s_gname)==-1)
            printf("%*d  ", prt->s_gid, (int)p->fts_statp->st_gid);
    }
    printsize(p);
    if (f_sortbyacc)
        printtime(p->fts_statp->st_atime);
    else if (f_sortbychg)
        printtime(p->fts_statp->st_ctime);
    else
        printtime(p->fts_statp->st_mtime);
    if (f_displgd) {
        sprintf(tmp, "%s%c", p->fts_name, type(p));
        length++;
    }
    else
        sprintf(tmp, "%s", p->fts_name);
    printstr(tmp, length);
    if (S_ISLNK(p->fts_statp->st_mode)) {
        int l;
        char buf[NAME_BUFSZ], path[NAME_BUFSZ];
        if (p->fts_level==0)
            sprintf(path, "%s", p->fts_name);
        else
            sprintf(path, "%s/%s", p->fts_parent->fts_accpath, p->fts_name);
        if ((l=readlink(path, buf, sizeof(path)))==-1)
            warn("%s", p->fts_path);
        buf[l]='\0';
        printf(" -> ");
        printstr(buf, prt->s_name);
    }
}
开发者ID:Kaikaiw,项目名称:apue,代码行数:54,代码来源:print.c


示例3: printlong

void
printlong(DISPLAY *dp)
{
	struct stat *sp;
	FTSENT *p;
	NAMES *np;
	char buf[20];

	if (dp->list->fts_level != FTS_ROOTLEVEL && (f_longform || f_size))
		(void)printf("total %llu\n", howmany(dp->btotal, blocksize));

	for (p = dp->list; p; p = p->fts_link) {
		if (IS_NOPRINT(p))
			continue;
		sp = p->fts_statp;
		if (f_inode)
			(void)printf("%*llu ", dp->s_inode,
			    (unsigned long long)sp->st_ino);
		if (f_size)
			(void)printf("%*lld ", dp->s_block,
			    howmany((long long)sp->st_blocks, blocksize));
		(void)strmode(sp->st_mode, buf);
		np = p->fts_pointer;
		(void)printf("%s %*u ", buf, dp->s_nlink, sp->st_nlink);
		if (!f_grouponly)
			(void)printf("%-*s  ", dp->s_user, np->user);
		(void)printf("%-*s  ", dp->s_group, np->group);
		if (f_flags)
			(void)printf("%-*s ", dp->s_flags, np->flags);
		if (S_ISCHR(sp->st_mode) || S_ISBLK(sp->st_mode))
			(void)printf("%3d, %3d ",
			    major(sp->st_rdev), minor(sp->st_rdev));
		else if (dp->bcfile)
			(void)printf("%*s%*lld ",
			    8 - dp->s_size, "", dp->s_size,
			    (long long)sp->st_size);
		else
			printsize(dp->s_size, sp->st_size);
		if (f_accesstime)
			printtime(sp->st_atime);
		else if (f_statustime)
			printtime(sp->st_ctime);
		else
			printtime(sp->st_mtime);
		(void)mbsprint(p->fts_name, 1);
		if (f_type || (f_typedir && S_ISDIR(sp->st_mode)))
			(void)printtype(sp->st_mode);
		if (S_ISLNK(sp->st_mode))
			printlink(p);
		(void)putchar('\n');
	}
}
开发者ID:a565109863,项目名称:src,代码行数:52,代码来源:print.c


示例4: main

int main()   
{   
    unsigned long count; //计数组合个数   
    unsigned int i,j,k,l;   
    bool findfirst,end,swap;   
    end=false;   
    printf("please input m:");   
    scanf("%d",&m); //输入m   
    printf("please input n:");   
    scanf("%d",&n); //输入n   
    printtime(); //打印开始时间   
    inition(); //初始化   
    //output(); //屏蔽掉结果输出以节约时间   
    count=1;   
    j=m;   
    while(!end)   
    {   
        findfirst=false;   

        swap=false; //标志复位   
        for(i=0;i<j;i++)   
        {   
            if(!findfirst && number[i])   
            {   
                k=i; //k记录下扫描到的第一个数   
                findfirst=true; //设置标志   
            }   
            if(number[i] && !number[i+1]) //从左到右扫描第一个“10”组合   
            {   
                number[i]=0;   
                number[i+1]=1;   
                swap=true; //设置交换标志   
                for(l=0;l<i-k;l++)   
                    number[l]=number[k+l];   
                for(l=i-k;l<i;l++)   
                    number[l]=0; //交换后将之前的“1”全部移动到最左端   
                if(k==i && i+1==m-n) //如果第一个“1”已经移动到了m-n的位置,说明
                                     //这是最后一个组合了。   
                        end=true;   
            }   
            if(swap) //交换一次后就不用继续找“10”组合了   
                break;   
        }
        output(); //屏蔽掉结果输出以节约时间   
        count++; //组合数计数器递增1   
    }
    printtime(); //打印结束时间   

    printf("total number of combination is: %d\n",count); //打印总的组合数  

    return 0;
}
开发者ID:zhanglistar,项目名称:Algorithm,代码行数:52,代码来源:Gen_Combination.c


示例5: main

int
main()
{
  _rtc_start_timekeeping_cog();
  printtime();
  pause(1);
  printtime();
  pause(2);
  printtime();
  pause(60);
  printtime();
  return 0;
}
开发者ID:jnlocke,项目名称:proplib,代码行数:13,代码来源:rtc.c


示例6: litterlanguage_work

void litterlanguage_work (void)
/******************************************************************************/
/* Function:	litterlanguage_work					      */
/*		- Worker function for the CatGenius LitterLanguage interpreter*/
/* History :	21 Feb 2010 by R. Delien:				      */
/*		- Initial revision.					      */
/******************************************************************************/
{
	/* Don't work if paused */
	if (paused)
		return;

	/* Check if a program is executed */
	if (ins_state != STATE_IDLE) {
		/* Check for filling timeout */
		if( !water_detected() &&
		    water_filling() &&
		    timeoutexpired(&timer_fill) ){
			printtime();
			DBG("Fill timeout\n");
			/* Fill error */
			error_fill = 1;
			litterlanguage_event(EVENT_ERR_FILLING, error_fill);
		}

		/* Check for draining timeout */
		if( water_detected() &&
		    get_Pump() &&
		    timeoutexpired(&timer_drain) ){
			printtime();
			DBG("Drain timeout\n");
			/* Drain error */
			error_drain = 1;
			litterlanguage_event(EVENT_ERR_DRAINING, error_drain);
		}
		/* Check auto-dose timeout */
		if (timeoutexpired(&timer_autodose)) {
			timeoutnever(&timer_autodose);
			set_Dosage(0);
		}
#ifdef CMM_ARM_EXPERIMENT
	}
		// Always check arm timeout, even if a prog is not running
#endif
		/* Check arm timeout */
		if (timeoutexpired(&timer_autoarm)) {
			timeoutnever(&timer_autoarm);
			set_Arm(ARM_STOP);
		}
#ifndef CMM_ARM_EXPERIMENT
	}
开发者ID:red13dotnet,项目名称:catgenius-deblobbed,代码行数:51,代码来源:litterlanguage.c


示例7: incminutes

void incminutes (void)
{
	settimeout(&second, SECOND);
	if (++currenttime.minutes >=60)
		currenttime.minutes = 0;
	printtime();
}
开发者ID:red13dotnet,项目名称:catgenius-deblobbed,代码行数:7,代码来源:rtc.c


示例8: printmsg

static void printmsg(acarsmsg_t * msg, int chn, time_t t)
{
	if (channel[chn].inmode == 3)
		fprintf(fdout, "\n[CH#%1d F:%3.3f L:%3d E:%1d   ", chn + 1,
			channel[chn].Fr / 1000000.0, msg->lvl, msg->err);
	else
		fprintf(fdout, "\n[CH#%1d E:%1d   ", chn + 1, msg->err);

	if (channel[chn].inmode != 2)
		printtime(t);

	fprintf(fdout, " --- ]\n");
	fprintf(fdout, "ACARS MODE:\t%1c\t", msg->mode);
	fprintf(fdout, "Aircraft REG:\t%s\n", msg->addr);

	fprintf(fdout, "MSG LABEL:\t%s\t", msg->label);
	fprintf(fdout, "Block ID:\t%c\n", msg->bid);

	fprintf(fdout, "Tech ACK:\t%c\n", msg->ack);

	if (msg->no[0] != '\0' || msg->fid[0] != '\0') {
		fprintf(fdout, "MSG NO.:\t%s\t", msg->no);
		fprintf(fdout, "Flight ID:\t%s\n", msg->fid);
	}

	if (strlen(msg->txt) != 0) {
		fprintf(fdout, "MSG Body:\n%s\n", msg->txt);
	}
 
	if (verbose && msg->be == 0x17)
		fprintf(fdout, "------- End Of Message -----\n");

	fflush(fdout);
}
开发者ID:Prez1313,项目名称:acarsx,代码行数:34,代码来源:output.c


示例9: printoneline

static void printoneline(acarsmsg_t * msg, int chn, time_t t)
{
	char txt[60];
	char *pstr;

	strncpy(txt, msg->txt, 60);
	txt[59] = 0;

	for (pstr = txt; *pstr != 0; pstr++)
		if (*pstr == '\n' || *pstr == '\r')
			*pstr = ' ';

	if (channel[chn].inmode == 3)
		fprintf(fdout, "#%1d (L:%3d E:%1d) ", chn + 1, msg->lvl,
			msg->err);
	else
		fprintf(fdout, "#%1d (E:%1d) ", chn + 1, msg->err);

	if (channel[chn].inmode != 2)
		printtime(t);

	/* uplink message, no flight id and no msg no */
	if (msg->fid[0] == '\0' && msg->no[0] == '\0')
		fprintf(fdout, " %7s %1c %2s ", msg->addr, msg->mode,
			msg->label);
	else
		fprintf(fdout, " %7s %6s %1c %2s %4s ", msg->addr, msg->fid,
			msg->mode, msg->label, msg->no);

	fprintf(fdout, "%s", txt);
	fprintf(fdout, "\n");
	fflush(fdout);
}
开发者ID:Prez1313,项目名称:acarsx,代码行数:33,代码来源:output.c


示例10: getfileinfo

void getfileinfo(void) {
  OFSTRUCT lpReOpenBuff;
  hfFile = (HANDLE)OpenFile(szFileName, &lpReOpenBuff, NULL);

  if (hfFile == (HANDLE)HFILE_ERROR) {
    err_msg();  // exit if error
    exit(0);
  }

  GetFileInformationByHandle(hfFile, &lpFileInformation);
  FileTimeToLocalFileTime(&lpFileInformation.ftLastWriteTime, &lpLastWriteLocalTime);
  FileTimeToSystemTime(&lpLastWriteLocalTime, &lpLastWriteSystemTime);

  GetFileTime(hfFile, &lpCreationTime, &lpLastAccessTime, &lpLastWriteTime);
  FileTimeToSystemTime(&lpCreationTime, &lpSystemTime);
  lpSystemTime.wYear = 2010;
  SystemTimeToFileTime(&lpSystemTime, &lpCreationTime);
  SetFileTime(hfFile, &lpCreationTime, &lpLastAccessTime, &lpLastWriteTime);


  printf ("\n\nFile size: %d", lpFileInformation.nFileSizeLow);
  printf ("\n---LastWriteTime---");
  printtime(lpLastWriteSystemTime);
  printf ("---FileAttributes---\n");
  printattrib();
  CloseHandle(hfFile);
}
开发者ID:Chuvi-w,项目名称:cpp-labs,代码行数:27,代码来源:LABSPO4.CPP


示例11: printoneline

static void printoneline(acarsmsg_t * msg, int chn, time_t t)
{
    char txt[30];
    char *pstr;

    strncpy(txt, msg->txt, 29);
    txt[29] = 0;
    for (pstr = txt; *pstr != 0; pstr++)
        if (*pstr == '\n' || *pstr == '\r')
            *pstr = ' ';

    if (msg->ack == 0x15)
        msg->ack = '!';
    if (msg->label[1] == 0x7f)
        msg->label[1] = 'd';

    if (inmode >= 3)
        fprintf(fdout, "#%1d (L:%3d E:%1d) ", chn + 1, msg->lvl,
            msg->err);
    else
        fprintf(fdout, "#%1d (E:%1d) ", chn + 1, msg->err);
    if (inmode != 2)
        printtime(t);
    if (msg->label[1] == 0x7f)
        msg->label[1] = 'd';
    fprintf(fdout, " %7s %6s %1c %2s %4s ", msg->addr, msg->fid, msg->mode,
        msg->label, msg->no);
    fprintf(fdout, "%s", txt);
    fprintf(fdout, "\n");
    fflush(fdout);
}
开发者ID:DavidBarts,项目名称:acarsdec,代码行数:31,代码来源:output.c


示例12: rt_dump

/*
 * should not need lock here. only showing stuff 
 */
	static void
rt_dump(const struct scheduler *ops)
{
	struct list_head *iter_sdom, *iter_svc, *runq, *iter;
	struct rt_private *prv = RT_PRIV(ops);
	struct rt_vcpu *svc;
	int cpu = 0;
	int loop = 0;

	printtime();
	printk("OCBP:_dumpV Priority Scheme: OCBP\n");

	printk("PCPU info: \n");
	for_each_cpu(cpu, &prv->cpus) 
		rt_dump_pcpu(ops, cpu);

	printk("OCBP:_dumpV Global RunQueue info: \n");
	loop = 0;
	runq = RUNQ(ops);
	list_for_each( iter, runq ) 
	{
		svc = __runq_elem(iter);
		printk("\tOCBP:_dumpV RunQ no:%3d: ", ++loop);
		rt_dump_vcpu(svc);
	}
开发者ID:gouravmodi1991,项目名称:RTOS_CPS,代码行数:28,代码来源:ocbpMC.c


示例13: _eWarning

void _eWarning(const char *file, int line, const char *function, const char* fmt, ...)
{
	char timebuffer[32];
	char header[256];
	char buf[1024];
	char ncbuf[1024];
	printtime(timebuffer, sizeof(timebuffer));
	snprintf(header, sizeof(header), "%s %s:%d %s ", timebuffer, file, line, function);
	va_list ap;
	va_start(ap, fmt);
	vsnprintf(buf, sizeof(buf), fmt, ap);
	removeAnsiEsc(buf, ncbuf);
	va_end(ap);
	singleLock s(DebugLock);
	logOutput(lvlWarning, std::string(header) + std::string(ncbuf) + "\n");
	if (logOutputConsole)
	{
		if (!logOutputColors)
			fprintf(stderr, "%s%s", header, ncbuf);
		else
		{
			snprintf(header, sizeof(header),	\
				ANSI_BLINK ANSI_BYELLOW	"%s "	/*color of timestamp*/\
				ANSI_GREEN	"%s:%d "	/*color of filename and linenumber*/\
				ANSI_BGREEN	"%s "		/*color of functionname*/\
				ANSI_BWHITE			/*color of debugmessage*/\
				, timebuffer, file, line, function);
			fprintf(stderr, "%s%s\n"ANSI_RESET, header, buf);
		}
	}
}
开发者ID:resmas,项目名称:enigma2,代码行数:31,代码来源:eerror.cpp


示例14: printlong

void
printlong(char *name,			/* filename to print */
	char *accpath,			/* current valid path to filename */
	struct stat *sb)		/* stat buffer */
{
	char modep[15];

	(void)printf("%7lu %6lld ", (u_long)sb->st_ino,
	    (long long)sb->st_blocks);
	(void)strmode(sb->st_mode, modep);
	(void)printf("%s %3lu %-*s %-*s ", modep, (unsigned long)sb->st_nlink,
	    LOGIN_NAME_MAX, user_from_uid(sb->st_uid, 0), LOGIN_NAME_MAX,
	    group_from_gid(sb->st_gid, 0));

	if (S_ISCHR(sb->st_mode) || S_ISBLK(sb->st_mode))
		(void)printf("%3llu,%5llu ",
		    (unsigned long long)major(sb->st_rdev),
		    (unsigned long long)minor(sb->st_rdev));
	else
		(void)printf("%9lld ", (long long)sb->st_size);
	printtime(sb->st_mtime);
	(void)printf("%s", name);
	if (S_ISLNK(sb->st_mode))
		printlink(accpath);
	(void)putchar('\n');
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:26,代码来源:ls.c


示例15: rt_dump_pcpu

	static void
rt_dump_pcpu(const struct scheduler *ops, int cpu)
{
	struct rt_vcpu *svc = RT_VCPU(curr_on_cpu(cpu));

	printtime();
	rt_dump_vcpu(svc);
}
开发者ID:gouravmodi1991,项目名称:RTOS_CPS,代码行数:8,代码来源:ocbpMC.c


示例16: QWidget

MyGraphics::MyGraphics (const char * argv, QWidget* obj) :	QWidget(obj), geometry(WIDTH,HEIGHT){
	gettimeofday(&start,NULL);	

	if ( strlen(argv) > 0 ){
	repeat:
			geometry.readFile(argv);
			geometry.saveFile("latest.cnfg");

			double obj=-1;
			while (obj){
				if (obj/geometry.numPoints() < 300 && obj > 0 &&
					geometry.redEqualBlue()){
					obj=geometry.genetics(0,start);
					if (obj == -1)
						break;
					update();
				} else {
				  if (timeout()){
						obj = -1;
						break;
				  } else
					obj=geometry.solver(0);
				}
			}   
			if(geometry.numRedPoints() != geometry.numBluePoints() || obj == -1) {
				std::string s;
				std::stringstream out;
				out << start.tv_sec;
				s = out.str();
				string file = "testing/";
				file += s;
				file += ".cnfg";
				printtime(geometry.numRedPoints(), geometry.numBluePoints(), start,
						geometry.getNS1I(), geometry.getNS2I());
				geometry.remove_blue_points();
				geometry.saveFile(file.c_str());
			} else {
			printtime(geometry.numRedPoints(), geometry.numBluePoints(), start,
						geometry.getNS1I(), geometry.getNS2I());
}


			exit(0); // Makes it easier to take time with: time ./gui_demo
	}
}
开发者ID:martin-mfg,项目名称:voronoi-thesis-tester,代码行数:45,代码来源:mygraphics.cpp


示例17: main

int main(int argc, char* argv[]) {
   HumdrumFile    infile;
   Array<double>  timings;
   Array<double>  tempo;

   // process the command-line options
   checkOptions(options, argc, argv);

   // figure out the number of input files to process
   int numinputs = options.getArgCount();

   double totaldur = 0.0;

   for (int i=0; i<numinputs || i==0; i++) {
      infile.clear();

      // if no command-line arguments read data file from standard input
      if (numinputs < 1) {
         infile.read(cin);
      } else {
         infile.read(options.getArg(i+1));
      }

      if (interpQ) {
         doLinearInterpolation(infile);
      } else {
         analyzeTiming(infile, timings, tempo);
         if (totalQ) {
            totaldur += timings[timings.getSize()-1];
            if (numinputs > 1) {
               printtime(options.getArg(i+1), timings[timings.getSize()-1]);
            }
         } else {
            printAnalysis(infile, timings, tempo);
         }
      }
   }
   if (totalQ) {
      printtime("", totaldur);
   }

   return 0;
}
开发者ID:ybroze,项目名称:humdrum,代码行数:43,代码来源:gettime.cpp


示例18: loop

static void loop(char *inst) {
  void *table[] = { &&L0, &&L1, &&L2, &&L3, &&L4, &&L5, &&L6, &&L7, &&L8, &&L9, &&L10, &&L11, &&L12, &&L13, &&L14, &&L15 };

  void **addrs = malloc(LEN * sizeof(void *));
  for (int i = 0; i < LEN; i++)
    addrs[i] = table[inst[i]];

  clock_gettime(CLOCK_REALTIME, &start);
#define NEXT goto *(*addrs++)
  NEXT;
L0: return;
L1: for (int i = 0; i < LOOP; i++) vec[1]++; NEXT;
L2: for (int i = 0; i < LOOP; i++) vec[2]++; NEXT;
L3: for (int i = 0; i < LOOP; i++) vec[3]++; NEXT;
L4: for (int i = 0; i < LOOP; i++) vec[4]++; NEXT;
L5: for (int i = 0; i < LOOP; i++) vec[5]++; NEXT;
L6: for (int i = 0; i < LOOP; i++) vec[6]++; NEXT;
L7: for (int i = 0; i < LOOP; i++) vec[7]++; NEXT;
L8: for (int i = 0; i < LOOP; i++) vec[8]++; NEXT;
L9: for (int i = 0; i < LOOP; i++) vec[9]++; NEXT;
L10: for (int i = 0; i < LOOP; i++) vec[10]++; NEXT;
L11: for (int i = 0; i < LOOP; i++) vec[11]++; NEXT;
L12: for (int i = 0; i < LOOP; i++) vec[12]++; NEXT;
L13: for (int i = 0; i < LOOP; i++) vec[13]++; NEXT;
L14: for (int i = 0; i < LOOP; i++) vec[14]++; NEXT;
L15: for (int i = 0; i < LOOP; i++) vec[15]++; NEXT;
}

void printvec() {
  for (int i = 0; i < 16; i++)
    printf("%d ", vec[i]);
  printf("\n");
}

void printtime() {
  struct timespec end;
  clock_gettime(CLOCK_REALTIME, &end);
  long t1 = start.tv_sec * 1000 * 1000 * 1000 + start.tv_nsec;
  long t2 = end.tv_sec * 1000 * 1000 * 1000 + end.tv_nsec;
  printf("time: %f\n", (t2 - t1) / 1e9);
}

int main(int argc, char **argv) {
  char *inst = malloc(LEN);
  for (int i = 0; i < LEN - 1;) {
    int op = rand() & 15;
    if (op == 0) continue;
    inst[i++] = op;
  }
  inst[LEN - 1] = 0;
  loop(inst);
  printvec();
  printtime();
  return 0;
}
开发者ID:rui314,项目名称:threading,代码行数:55,代码来源:direct.c


示例19: _eWarning

void _eWarning(const char *file, int line, const char *function, const char* fmt, ...)
{
	char timebuffer[32];
	char header[256];
	char buf[1024];
	char ncbuf[1024];
	printtime(timebuffer, sizeof(timebuffer));
	snprintf(header, sizeof(header), "%s [!W!] %s:%d %s ", timebuffer, file, line, function);
	va_list ap;
	va_start(ap, fmt);
	vsnprintf(buf, sizeof(buf), fmt, ap);
	removeAnsiEsc(buf, ncbuf);
	va_end(ap);
	singleLock s(DebugLock);
	logOutput(lvlWarning, std::string(header) + std::string(ncbuf) + "\n");
	if (logOutputConsole)
	{
		if (!logOutputColors)
		{
			if(m_erroroutput && m_erroroutput->eErrorOutput::pipe_fd[1] && m_erroroutput->eErrorOutput::threadrunning)
			{
				int n;
				char obuf[1024];
				snprintf(obuf, sizeof(obuf), "%s%s\n", header, ncbuf);
				n=write(m_erroroutput->eErrorOutput::pipe_fd[1], obuf, strlen(obuf));
				if(n<0)
					fprintf(stderr, "[eerror] row %d error: %s\n", __LINE__,strerror(errno));
			}
			else
				fprintf(stderr, "%s%s\n", header, ncbuf);
		}
		else
		{
			snprintf(header, sizeof(header),	\
						"%s"		/*newline*/
				ANSI_BYELLOW	"%s "	/*color of timestamp*/\
				ANSI_GREEN	"%s:%d "	/*color of filename and linenumber*/\
				ANSI_BGREEN	"%s "		/*color of functionname*/\
				ANSI_BWHITE			/*color of debugmessage*/\
				, inNoNewLine?"\n":"", timebuffer, file, line, function);
			if(m_erroroutput && m_erroroutput->eErrorOutput::pipe_fd[1] && m_erroroutput->eErrorOutput::threadrunning)
			{
				int n;
				char obuf[1024];
				snprintf(obuf, sizeof(obuf), "%s%s\n"ANSI_RESET, header, buf);
				n=write(m_erroroutput->eErrorOutput::pipe_fd[1], obuf, strlen(obuf));
				if(n<0)
					fprintf(stderr, "[eerror] row %d error: %s\n", __LINE__,strerror(errno));
			}
			else
				fprintf(stderr, "%s%s\n"ANSI_RESET, header, buf);
		}
	}
	inNoNewLine = false;
}
开发者ID:frankzh,项目名称:enigma2,代码行数:55,代码来源:eerror.cpp


示例20: main

int main(int argc, char **argv)
{
    bool ok = false;
    bool t  = false;
    bool c  = true;
    bool v  = false;
    int  l  = 5;
    int  n  = 0;
    int  m  = 0;
    int  p  = 0;
    int  e  = 0;
    int  o;

    // Parse the command line options.

    while ((o = getopt(argc, argv, "l:n:m:p:terv")) != -1)
        switch (o)
        {
            case 't': t = true;                 break;
            case 'r': c = false;                break;
            case 'v': v = true;                 break;
            case 'l': l = strtol(optarg, 0, 0); break;
            case 'n': n = strtol(optarg, 0, 0); break;
            case 'm': m = strtol(optarg, 0, 0); break;
            case 'p': p = strtol(optarg, 0, 0); break;
            case 'e': e = 1;                    break;
            case '?':
            default : return usage(argv[0]);
        }

    // Confirm the arguments and run the process.

    setexe(argv[0]);

    struct timeval t0;
    struct timeval t1;

    gettimeofday(&t0, 0);
    {
        if (optind + 2 == argc)
        {
            if (istif(argv[optind]))
                ok = tiftoimg(v, e, l,          argv[optind], argv[optind + 1]);
            else
                ok = imgtotif(c, e, l, n, m, p, argv[optind], argv[optind + 1]);
        }
        else return usage(argv[0]);
    }
    gettimeofday(&t1, 0);

    if (t) printtime(&t0, &t1);

    return ok ? EXIT_SUCCESS : EXIT_FAILURE;
}
开发者ID:rlk,项目名称:gigo,代码行数:54,代码来源:convert.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ printusage函数代码示例发布时间:2022-05-30
下一篇:
C++ printsub函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap