您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ to_tm函数代码示例

51自学网 2021-06-03 08:54:43
  C++
这篇教程C++ to_tm函数代码示例写得很实用,希望能帮到您。

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

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

示例1: m48t37y_set_time

int m48t37y_set_time(unsigned long sec){	struct rtc_time tm;	/* convert to a more useful format -- note months count from 0 */	to_tm(sec, &tm);	tm.tm_mon += 1;	/* enable writing */	m48t37_base->control = 0x80;	/* year */	m48t37_base->year = BIN2BCD(tm.tm_year % 100);	m48t37_base->century = BIN2BCD(tm.tm_year / 100);	/* month */	m48t37_base->month = BIN2BCD(tm.tm_mon);	/* day */	m48t37_base->date = BIN2BCD(tm.tm_mday);	/* hour/min/sec */	m48t37_base->hour = BIN2BCD(tm.tm_hour);	m48t37_base->min = BIN2BCD(tm.tm_min);	m48t37_base->sec = BIN2BCD(tm.tm_sec);	/* day of week -- not really used, but let's keep it up-to-date */	m48t37_base->day = BIN2BCD(tm.tm_wday + 1);	/* disable writing */	m48t37_base->control = 0x00;	return 0;}
开发者ID:Antonio-Zhou,项目名称:Linux-2.6.11,代码行数:34,


示例2: indy_rtc_set_time

static int indy_rtc_set_time(unsigned long tim){	struct rtc_time tm;	unsigned int save_control;	unsigned long flags;	to_tm(tim, &tm);	tm.tm_mon += 1;		/* tm_mon starts at zero */	tm.tm_year -= 1940;	if (tm.tm_year >= 100)		tm.tm_year -= 100;	spin_lock_irqsave(&rtc_lock, flags);	save_control = hpc3c0->rtcregs[RTC_CMD] & 0xff;	hpc3c0->rtcregs[RTC_CMD] = save_control | RTC_TE;	hpc3c0->rtcregs[RTC_YEAR] = BIN2BCD(tm.tm_year);	hpc3c0->rtcregs[RTC_MONTH] = BIN2BCD(tm.tm_mon);	hpc3c0->rtcregs[RTC_DATE] = BIN2BCD(tm.tm_mday);	hpc3c0->rtcregs[RTC_HOURS] = BIN2BCD(tm.tm_hour);	hpc3c0->rtcregs[RTC_MINUTES] = BIN2BCD(tm.tm_min);	hpc3c0->rtcregs[RTC_SECONDS] = BIN2BCD(tm.tm_sec);	hpc3c0->rtcregs[RTC_HUNDREDTH_SECOND] = 0;	hpc3c0->rtcregs[RTC_CMD] = save_control;	spin_unlock_irqrestore(&rtc_lock, flags);	return 0;}
开发者ID:420GrayFox,项目名称:dsl-n55u-bender,代码行数:30,


示例3: Time_Display

/* * 函数名:Time_Display * 描述  :显示当前时间值 * 输入  :-TimeVar RTC计数值,单位为 s * 输出  :无 * 调用  :内部调用 */	void Time_Display(uint32_t TimeVar,struct rtc_time *tm){	   static uint32_t FirstDisplay = 1;	   uint32_t BJ_TimeVar;	   uint8_t str[15]; // 字符串暂存  		   /*  把标准时间转换为北京时间*/	   BJ_TimeVar =TimeVar + 8*60*60;	   to_tm(BJ_TimeVar, tm);/*把定时器的值转换为北京时间*/			  if((!tm->tm_hour && !tm->tm_min && !tm->tm_sec)  || (FirstDisplay))	  {	      	      GetChinaCalendar((u16)tm->tm_year, (u8)tm->tm_mon, (u8)tm->tm_mday, str);		      printf("/r/n/r/n  今天农历:%0.2d%0.2d,%0.2d,%0.2d", str[0], str[1], str[2],  str[3]);		      GetChinaCalendarStr((u16)tm->tm_year,(u8)tm->tm_mon,(u8)tm->tm_mday,str);	      printf("  %s", str);		     if(GetJieQiStr((u16)tm->tm_year, (u8)tm->tm_mon, (u8)tm->tm_mday, str))	          printf("  %s/n/r", str);		      FirstDisplay = 0;	  }	 	  		  /* 输出时间戳,公历时间 */	  printf("/r  UNIX时间戳 = %d ,当前时间为: %d年(%s年) %d月 %d日 (星期%s)  %0.2d:%0.2d:%0.2d",TimeVar,	                    tm->tm_year, zodiac_sign[(tm->tm_year-3)%12], tm->tm_mon, tm->tm_mday, 	                    WEEK_STR[tm->tm_wday], tm->tm_hour, 	                    tm->tm_min, tm->tm_sec);}
开发者ID:yhyuan,项目名称:STM32-Examples,代码行数:41,


示例4: SntpHandler

static void SntpHandler(uchar *pkt, unsigned dest, unsigned src, unsigned len){	struct sntp_pkt_t *rpktp = (struct sntp_pkt_t *)pkt;	struct rtc_time tm;	ulong seconds;#ifdef DEBUG	printf("%s/n", __FUNCTION__);#endif	if(dest != SntpOurPort){		return;	}	/*	 * As the RTC's used in U-Boot supports second resolution only	 * we simply ignore the sub-second field.	 */	memcpy(&seconds, &rpktp->transmit_timestamp, sizeof(ulong));	to_tm(ntohl(seconds) - 2208988800UL + NetTimeOffset, &tm);#if (CONFIG_COMMANDS & CFG_CMD_DATE)	// TODO: find out how to use RTC on	//rtc_set(&tm);#endif	printf("Got SNTP response: %4d-%02d-%02d %2d:%02d:%02d/n/n", tm.tm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);	NetState = NETLOOP_SUCCESS;}
开发者ID:a291899192,项目名称:u-boot_mod,代码行数:28,


示例5: rtc_ioctl

static intrtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,	  unsigned long arg){	struct rtc_time rtc_tm;	ulong curr_time;	switch (cmd) {	case RTC_RD_TIME:	/* Read the time/date from RTC  */		curr_time = rtc_get_time();		to_tm(curr_time, &rtc_tm);		rtc_tm.tm_year -= 1900;		return copy_to_user((void *) arg, &rtc_tm, sizeof(rtc_tm)) ? 			-EFAULT : 0;	case RTC_SET_TIME:	/* Set the RTC */		if (!capable(CAP_SYS_TIME))			return -EACCES;		if (copy_from_user(&rtc_tm, 				   (struct rtc_time *) arg,		                   sizeof(struct rtc_time))) 			return -EFAULT;		curr_time = mktime(rtc_tm.tm_year + 1900,				   rtc_tm.tm_mon,				   rtc_tm.tm_mday,				   rtc_tm.tm_hour,				   rtc_tm.tm_min, 				   rtc_tm.tm_sec);		return rtc_set_time(curr_time);	default:		return -EINVAL;	}}
开发者ID:zipangotes,项目名称:DSL-G624T_GPL_code,代码行数:34,


示例6: print_image_hdr

void print_image_hdr(image_header_t *hdr) {#if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP)	time_t timestamp = (time_t)ntohl(hdr->ih_time);	struct rtc_time tm;#endif	printf("   Image Name:   %.*s/n", IH_NMLEN, hdr->ih_name);#if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP)	to_tm (timestamp, &tm);	printf ("   Created:      %4d-%02d-%02d  %2d:%02d:%02d UTC/n",			tm.tm_year, tm.tm_mon, tm.tm_mday,			tm.tm_hour, tm.tm_min, tm.tm_sec);#endif	/* CFG_CMD_DATE, CONFIG_TIMESTAMP */	puts("   Image Type:   ");	print_type(hdr);	printf("/n   Data Size:    %d Bytes = ", ntohl(hdr->ih_size));	print_size(ntohl(hdr->ih_size), "/n");	printf("   Load Address: %08x/n"			"   Entry Point:  %08x/n", ntohl(hdr->ih_load), ntohl(hdr->ih_ep));	if (hdr->ih_type == IH_TYPE_MULTI) {		int i;		ulong len;		ulong *len_ptr = (ulong *) ((ulong) hdr + sizeof(image_header_t));		puts("   Contents:/n");		for (i = 0; (len = ntohl(*len_ptr)); ++i, ++len_ptr) {			printf("   Image %d: %8ld Bytes = ", i, len);			print_size(len, "/n");		}	}}
开发者ID:SLboat,项目名称:WR703N_uboot_with_SLboat_Mod,代码行数:32,


示例7: m48t37y_set_time

int m48t37y_set_time(unsigned long sec){	struct rtc_time tm;	/* convert to a more useful format -- note months count from 0 */	to_tm(sec, &tm);	tm.tm_mon += 1;	/* enable writing */	rtc_base[0x7ff8] = 0x80;	/* year */	rtc_base[0x7fff] = BIN2BCD(tm.tm_year % 100);	rtc_base[0x7ff1] = BIN2BCD(tm.tm_year / 100);	/* month */	rtc_base[0x7ffe] = BIN2BCD(tm.tm_mon);	/* day */	rtc_base[0x7ffd] = BIN2BCD(tm.tm_mday);	/* hour/min/sec */	rtc_base[0x7ffb] = BIN2BCD(tm.tm_hour);	rtc_base[0x7ffa] = BIN2BCD(tm.tm_min);	rtc_base[0x7ff9] = BIN2BCD(tm.tm_sec);	/* day of week -- not really used, but let's keep it up-to-date */	rtc_base[0x7ffc] = BIN2BCD(tm.tm_wday + 1);	/* disable writing */	rtc_base[0x7ff8] = 0x00;	return 0;}
开发者ID:iPodLinux,项目名称:linux-2.6.7-ipod,代码行数:34,


示例8: rtc_get

/* Read the time from the RTC_STAT. time_in_seconds is seconds since Jan 1970 */int rtc_get(struct rtc_time *tmp){	uint32_t cur_rtc_stat;	int time_in_sec;	int tm_sec, tm_min, tm_hr, tm_day;	pr_stamp();	if (tmp == NULL) {		puts("Error getting the date/time/n");		return -1;	}	rtc_init();	wait_for_complete();	/* Read the RTC_STAT register */	cur_rtc_stat = bfin_read_RTC_STAT();	/* Convert our encoded format into actual time values */	tm_sec = (cur_rtc_stat & RTC_SEC) >> RTC_SEC_P;	tm_min = (cur_rtc_stat & RTC_MIN) >> RTC_MIN_P;	tm_hr  = (cur_rtc_stat & RTC_HR ) >> RTC_HR_P;	tm_day = (cur_rtc_stat & RTC_DAY) >> RTC_DAY_P;	/* Calculate the total number of seconds since epoch */	time_in_sec = (tm_sec) + MIN_TO_SECS(tm_min) + HRS_TO_SECS(tm_hr) + DAYS_TO_SECS(tm_day);	to_tm(time_in_sec, tmp);	return 0;}
开发者ID:DeviceSolutions,项目名称:u-boot-opal6,代码行数:32,


示例9: misc_init_r

/* ------------------------------------------------------------------------- */int misc_init_r (void){	char *s, *e;	image_header_t *hdr;	time_t timestamp;	struct rtc_time tm;	char bootcmd[32];	hdr = (image_header_t *) (CFG_MONITOR_BASE - sizeof (image_header_t));	timestamp = (time_t) hdr->ih_time;	to_tm (timestamp, &tm);	printf ("Welcome to U-Boot on Cray L1. Compiled %4d-%02d-%02d  %2d:%02d:%02d (UTC)/n", tm.tm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);#define FACTORY_SETTINGS 0xFFFC0000	if ((s = getenv ("ethaddr")) == NULL) {		e = (char *) (FACTORY_SETTINGS);		if (*(e + 0) != '0'			|| *(e + 1) != '0'			|| *(e + 2) != ':'			|| *(e + 3) != '4' || *(e + 4) != '0' || *(e + 17) != '/0') {			printf ("No valid MAC address in flash location 0x3C0000!/n");		} else {			printf ("Factory MAC: %s/n", e);			setenv ("ethaddr", e);		}	}	sprintf (bootcmd,"autoscript %X",(unsigned)bootscript);	setenv ("bootcmd", bootcmd);	return (0);}
开发者ID:CharlieWood,项目名称:uboot-imx,代码行数:31,


示例10: mk48t59_set_rtc_time

__prepint mk48t59_set_rtc_time(unsigned long nowtime){	unsigned char save_control;	struct rtc_time tm;	to_tm(nowtime, &tm);	/* tell the clock it's being written */	save_control = ppc_md.nvram_read_val(MK48T59_RTC_CONTROLA);		ppc_md.nvram_write_val(MK48T59_RTC_CONTROLA,			     (save_control | MK48T59_RTC_CA_WRITE));        tm.tm_year = (tm.tm_year - 1900) % 100;	BIN_TO_BCD(tm.tm_sec);	BIN_TO_BCD(tm.tm_min);	BIN_TO_BCD(tm.tm_hour);	BIN_TO_BCD(tm.tm_mon);	BIN_TO_BCD(tm.tm_mday);	BIN_TO_BCD(tm.tm_year);	ppc_md.nvram_write_val(MK48T59_RTC_SECONDS,      tm.tm_sec);	ppc_md.nvram_write_val(MK48T59_RTC_MINUTES,      tm.tm_min);	ppc_md.nvram_write_val(MK48T59_RTC_HOURS,        tm.tm_hour);	ppc_md.nvram_write_val(MK48T59_RTC_MONTH,        tm.tm_mon);	ppc_md.nvram_write_val(MK48T59_RTC_DAY_OF_MONTH, tm.tm_mday);	ppc_md.nvram_write_val(MK48T59_RTC_YEAR,         tm.tm_year);		/* Turn off the write bit. */	ppc_md.nvram_write_val(MK48T59_RTC_CONTROLA, save_control);	return 0;}
开发者ID:chinnyannieb,项目名称:empeg-hijack,代码行数:35,


示例11: it8172_rtc_set_time

static intit8172_rtc_set_time(unsigned long t){	struct rtc_time tm;	unsigned int flags;	/* convert */	to_tm(t, &tm);	/* avoid update-in-progress. */	for (;;) {		local_irq_save(flags);		if (! (CMOS_READ(RTC_REG_A) & RTC_UIP))			break;		/* don't hold intr closed all the time */		local_irq_restore(flags);	}	*rtc_century_reg = bin_to_hw(tm.tm_year/100);	CMOS_WRITE(bin_to_hw(tm.tm_sec), RTC_SECONDS);	CMOS_WRITE(bin_to_hw(tm.tm_min), RTC_MINUTES);	CMOS_WRITE(hour_bin_to_hw(tm.tm_hour), RTC_HOURS);	CMOS_WRITE(bin_to_hw(tm.tm_mday), RTC_DAY_OF_MONTH);	CMOS_WRITE(bin_to_hw(tm.tm_mon+1), RTC_MONTH);	/* tm_mon starts from 0 */	CMOS_WRITE(bin_to_hw(tm.tm_year%100), RTC_YEAR);	/* restore interrupts */	local_irq_restore(flags);	return 0;}
开发者ID:12019,项目名称:hg556a_source,代码行数:31,


示例12: timer_check_rtc

static __inline__ void timer_check_rtc(void){        /*         * update the rtc when needed, this should be performed on the         * right fraction of a second. Half or full second ?         * Full second works on mk48t59 clocks, others need testing.         * Note that this update is basically only used through          * the adjtimex system calls. Setting the HW clock in         * any other way is a /dev/rtc and userland business.         * This is still wrong by -0.5/+1.5 jiffies because of the         * timer interrupt resolution and possible delay, but here we          * hit a quantization limit which can only be solved by higher         * resolution timers and decoupling time management from timer         * interrupts. This is also wrong on the clocks         * which require being written at the half second boundary.         * We should have an rtc call that only sets the minutes and         * seconds like on Intel to avoid problems with non UTC clocks.         */        if ( (time_status & STA_UNSYNC) == 0 &&             xtime.tv_sec - last_rtc_update >= 659 &&             abs((xtime.tv_nsec/1000) - (1000000-1000000/HZ)) < 500000/HZ &&             jiffies - wall_jiffies == 1) {	    struct rtc_time tm;	    to_tm(xtime.tv_sec+1, &tm);	    tm.tm_year -= 1900;	    tm.tm_mon -= 1;            if (ppc_md.set_rtc_time(&tm) == 0)                last_rtc_update = xtime.tv_sec+1;            else                /* Try again one minute later */                last_rtc_update += 60;        }}
开发者ID:sarnobat,项目名称:knoppix,代码行数:33,


示例13: SntpHandler

static voidSntpHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len){	struct sntp_pkt_t *rpktp = (struct sntp_pkt_t *)pkt;	struct rtc_time tm;	ulong seconds;	debug ("%s/n", __FUNCTION__);	if (dest != SntpOurPort) return;	/*	 * As the RTC's used in U-Boot sepport second resolution only	 * we simply ignore the sub-second field.	 */	memcpy (&seconds, &rpktp->transmit_timestamp, sizeof(ulong));	to_tm(ntohl(seconds) - 2208988800UL + NetTimeOffset, &tm);#if defined(CONFIG_CMD_DATE)	rtc_set (&tm);#endif	printf ("Date: %4d-%02d-%02d Time: %2d:%02d:%02d/n",		tm.tm_year, tm.tm_mon, tm.tm_mday,		tm.tm_hour, tm.tm_min, tm.tm_sec);	NetState = NETLOOP_SUCCESS;}
开发者ID:kipr,项目名称:u-boot-2009.07-silvermoon,代码行数:27,


示例14: to_tm

int _rrTime::weekDay() const{	tm conv;	to_tm(conv);	int day=(conv.tm_wday-1);	if (day<0) day+=7;	if (day<0) day=0; else if (day>6) day=6;	return day;}
开发者ID:michimussato,项目名称:pypelyne2,代码行数:9,


示例15: mv_set_rtc

static int mv_set_rtc(void){	MV_RTC_TIME time;	to_tm(xtime.tv_sec, &time);	time.year -= 2000;	mvRtcTimeSet(&time);	return 1;}
开发者ID:jameshilliard,项目名称:prism,代码行数:9,


示例16: put

    OutItrT put(OutItrT a_next,                 std::ios_base& a_ios,                 char_type a_fill,                 const time_type& a_time) const     {      if (a_time.is_special()) {         return do_put_special(a_next, a_ios, a_fill,                               a_time.date().as_special());      }      string_type format(m_format);      string_type frac_str;      if (format.find(seconds_with_fractional_seconds_format)) {        // replace %s with %S.nnn         frac_str =           fractional_seconds_as_string(a_time.time_of_day(), false);        char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point();                string_type replace_string(seconds_format);        replace_string += sep;        replace_string += frac_str;        boost::algorithm::replace_all(format,                                       seconds_with_fractional_seconds_format,                                       replace_string);      }      if (format.find(fractional_seconds_format)) {        // replace %f with nnnnnnn        if (!frac_str.size()) {          frac_str = fractional_seconds_as_string(a_time.time_of_day(), false);        }        boost::algorithm::replace_all(format,                                      fractional_seconds_format,                                       frac_str);      }      if (format.find(fractional_seconds_or_none_format)) {        // replace %F with nnnnnnn or nothing if fs == 0        frac_str =           fractional_seconds_as_string(a_time.time_of_day(), true);        if (frac_str.size()) {          char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point();          string_type replace_string;          replace_string += sep;          replace_string += frac_str;          boost::algorithm::replace_all(format,                                        fractional_seconds_or_none_format,                                         replace_string);        }        else {          boost::algorithm::erase_all(format,                                      fractional_seconds_or_none_format);        }      }      return do_put_tm(a_next, a_ios, a_fill,                        to_tm(a_time), format);    }
开发者ID:dmm,项目名称:cegis,代码行数:56,


示例17: _dump_time

static void __maybe_unused _dump_time(int time, const char *func,	int line){	struct rtc_time tm;	to_tm(time, &tm);	pr_debug("%s:%d time    %d/n", func, line, time);	_dump_tm(&tm, func, line);}
开发者ID:jakev,项目名称:CobraDroidBeta,代码行数:10,


示例18: rtc_get

int rtc_get(struct rtc_time *time){	struct mxs_rtc_regs *rtc_regs = (struct mxs_rtc_regs *)MXS_RTC_BASE;	uint32_t secs;	secs = readl(&rtc_regs->hw_rtc_seconds);	to_tm(secs, time);	return 0;}
开发者ID:AeroGirl,项目名称:u-boot-kern3.2,代码行数:10,


示例19: beat_get_rtc_time

void beat_get_rtc_time(struct rtc_time *rtc_time){	u64 tim;	if (beat_rtc_read(&tim))		tim = 0;	to_tm(tim, rtc_time);	rtc_time->tm_year -= 1900;	rtc_time->tm_mon -= 1;}
开发者ID:007kumarraja,项目名称:rockchip-rk3188-mk908,代码行数:10,


示例20: rtc_post_restore

static void rtc_post_restore (struct rtc_time *tm, unsigned int sec){	time_t t = mktime (tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour,					   tm->tm_min, tm->tm_sec) + sec;	struct rtc_time ntm;	to_tm (t, &ntm);	rtc_set (&ntm);}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:10,


示例21: xicor_set_time

int xicor_set_time(unsigned long t){	struct rtc_time tm;	int tmp;	to_tm(t, &tm);	/* unlock writes to the CCR */	xicor_write(X1241REG_SR, X1241REG_SR_WEL);	xicor_write(X1241REG_SR, X1241REG_SR_WEL | X1241REG_SR_RWEL);	/* trivial ones */	tm.tm_sec = BIN2BCD(tm.tm_sec);	xicor_write(X1241REG_SC, tm.tm_sec);	tm.tm_min = BIN2BCD(tm.tm_min);	xicor_write(X1241REG_MN, tm.tm_min);	tm.tm_mday = BIN2BCD(tm.tm_mday);	xicor_write(X1241REG_DT, tm.tm_mday);	/* tm_mon starts from 0, *ick* */	tm.tm_mon ++;	tm.tm_mon = BIN2BCD(tm.tm_mon);	xicor_write(X1241REG_MO, tm.tm_mon);	/* year is split */	tmp = tm.tm_year / 100;	tm.tm_year %= 100;	xicor_write(X1241REG_YR, tm.tm_year);	xicor_write(X1241REG_Y2K, tmp);	/* hour is the most tricky one */	tmp = xicor_read(X1241REG_HR);	if (tmp & X1241REG_HR_MIL) {		/* 24 hour format */		tm.tm_hour = BIN2BCD(tm.tm_hour);		tmp = (tmp & ~0x3f) | (tm.tm_hour & 0x3f);	} else {		/* 12 hour format, with 0x2 for pm */		tmp = tmp & ~0x3f;		if (tm.tm_hour >= 12) {			tmp |= 0x20;			tm.tm_hour -= 12;		}		tm.tm_hour = BIN2BCD(tm.tm_hour);		tmp |= tm.tm_hour;	}	xicor_write(X1241REG_HR, tmp);	xicor_write(X1241REG_SR, 0);	return 0;}
开发者ID:12019,项目名称:hg556a_source,代码行数:54,


示例22: str

void SFTWorker::finishFile(){	m_hFh.close();	std::string file = m_pCurFile->getFullPath();	gcString str("{0}", m_pCurFile->getTimeStamp());	try	{		ptime t(from_iso_string(str));		bfs::path spath(file);		tm pt_tm = to_tm(t);		last_write_time(spath, mktime(&pt_tm));	}	catch (...)	{		Warning(gcString("Failed to change {0} time stamp to {1}./n", m_pCurFile->getName(), str));	}	safe_delete(m_pBzs);	std::string hash = "Failed to generate hash";#ifdef NIX	//struct stat s;	bool isWinExe = false;		if (file.size() > 4)	{		std::string lastFour(file.end() - 4, file.end());		std::transform(lastFour.begin(), lastFour.end(), lastFour.begin(), ::toupper);		if (lastFour == ".EXE")			isWinExe = true;	}		//( && stat(file.c_str(), &s) == 0) 		bool isExecutable = HasAnyFlags(m_pCurFile->getFlags(), MCFCore::MCFFileI::FLAG_XECUTABLE);	if (isExecutable || isWinExe)		chmod(file.c_str(), (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH));#endif	if (m_pCurFile->isZeroSize() || m_pCurFile->hashCheckFile(&hash))	{		m_pCT->endTask(m_uiId, BaseMCFThread::SF_STATUS_COMPLETE);	}	else	{		Warning(gcString("Hash check failed for file [{0}]: Cur: {1} !=  Should: {2}/n", m_pCurFile->getName(), hash, m_pCurFile->getCsum()));		m_pCT->endTask(m_uiId, BaseMCFThread::SF_STATUS_HASHMISSMATCH);	}}
开发者ID:Alasaad,项目名称:Desurium,代码行数:54,


示例23: put

 OutItrT put(OutItrT next,             std::ios_base& a_ios,             char_type fill_char,             const date_type& d) const {   if (d.is_special()) {     return do_put_special(next, a_ios, fill_char, d.as_special());   }   //The following line of code required the date to support a to_tm function   return do_put_tm(next, a_ios, fill_char, to_tm(d), m_format); }
开发者ID:imos,项目名称:icfpc2015,代码行数:11,


示例24: todc_set_rtc_time

inttodc_set_rtc_time(unsigned long nowtime){	struct rtc_time	tm;	u_char		save_control, save_freq_select = 0;	spin_lock(&rtc_lock);	to_tm(nowtime, &tm);	save_control = todc_read_val(todc_info->control_a);	/* Assuming MK48T59_RTC_CA_WRITE & RTC_SET are equal */	todc_write_val(todc_info->control_a,			       (save_control | todc_info->enable_write));	save_control &= ~(todc_info->enable_write); /* in case it was set */	if (todc_info->rtc_type == TODC_TYPE_MC146818) {		save_freq_select = todc_read_val(todc_info->RTC_FREQ_SELECT);		todc_write_val(todc_info->RTC_FREQ_SELECT,				       save_freq_select | RTC_DIV_RESET2);	}        tm.tm_year = (tm.tm_year - 1900) % 100;	if ((todc_info->rtc_type != TODC_TYPE_MC146818) ||	    ((save_control & RTC_DM_BINARY) == 0) ||	    RTC_ALWAYS_BCD) {		BIN_TO_BCD(tm.tm_sec);		BIN_TO_BCD(tm.tm_min);		BIN_TO_BCD(tm.tm_hour);		BIN_TO_BCD(tm.tm_mon);		BIN_TO_BCD(tm.tm_mday);		BIN_TO_BCD(tm.tm_year);	}	todc_write_val(todc_info->seconds,      tm.tm_sec);	todc_write_val(todc_info->minutes,      tm.tm_min);	todc_write_val(todc_info->hours,        tm.tm_hour);	todc_write_val(todc_info->month,        tm.tm_mon);	todc_write_val(todc_info->day_of_month, tm.tm_mday);	todc_write_val(todc_info->year,         tm.tm_year);	todc_write_val(todc_info->control_a, save_control);	if (todc_info->rtc_type == TODC_TYPE_MC146818) {		todc_write_val(todc_info->RTC_FREQ_SELECT, save_freq_select);	}	spin_unlock(&rtc_lock);	return 0;}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:53,


示例25: get_rtc_time

unsigned int get_rtc_time(struct rtc_time *time){	unsigned long nowtime;	spin_lock(&mips_rtc_lock);	nowtime = rtc_get_time();	to_tm(nowtime, time);	time->tm_year -= 1900;	spin_unlock(&mips_rtc_lock);	return RTC_24H;}
开发者ID:foxsat-hdr,项目名称:linux-kernel,代码行数:12,



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


C++ to_txe_hw函数代码示例
C++ to_struct_type函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。