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


C++ printtime函数代码示例

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


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


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