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

C++ rtc_time_to_tm函数代码示例

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

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



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

示例1: sprd_rtc_read_alarm

static int sprd_rtc_read_alarm(struct device *dev,
		struct rtc_wkalrm *alrm)
{
	unsigned long secs = sprd_rtc_get_alarm_sec();

	secs = secs + secs_start_year_to_1970;
	rtc_time_to_tm(secs, &alrm->time);

	alrm->enabled = !!(sci_adi_read(ANA_RTC_INT_EN) & RTC_ALARM_BIT);
	alrm->pending = !!(sci_adi_read(ANA_RTC_INT_RSTS) & RTC_ALARM_BIT);

	printk("rtc_alarm:alrm->enabled=%d,secs=%lu\n",alrm->enabled,secs);
	return 0;
}
开发者ID:feravolt,项目名称:Beast-Kernel-Samsung-StarPro,代码行数:14,代码来源:rtc-sprd.c


示例2: ktd259b_backlight_earlyresume

static void ktd259b_backlight_earlyresume(struct early_suspend *desc)
{
	struct ktd259b_bl_data *ktd259b = container_of(desc, struct ktd259b_bl_data,
				early_suspend_desc);
	struct backlight_device *bl = platform_get_drvdata(ktd259b->pdev);
      struct timespec ts;
      struct rtc_time tm;
    
	getnstimeofday(&ts);
	rtc_time_to_tm(ts.tv_sec, &tm);
       backlight_mode=BACKLIGHT_RESUME;
       printk("[%02d:%02d:%02d.%03lu][BACKLIGHT] earlyresume\n", tm.tm_hour, tm.tm_min, tm.tm_sec, ts.tv_nsec);
       backlight_update_status(bl);
}
开发者ID:ROM-PacMe,项目名称:android_kernel_samsung_coriplus,代码行数:14,代码来源:ktd259b_bl.c


示例3: coh901331_read_time

static int coh901331_read_time(struct device *dev, struct rtc_time *tm)
{
	struct coh901331_port *rtap = dev_get_drvdata(dev);

	clk_enable(rtap->clk);
	/*                            */
	if (readl(rtap->virtbase + COH901331_VALID)) {
		rtc_time_to_tm(readl(rtap->virtbase + COH901331_CUR_TIME), tm);
		clk_disable(rtap->clk);
		return rtc_valid_tm(tm);
	}
	clk_disable(rtap->clk);
	return -EINVAL;
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:14,代码来源:rtc-coh901331.c


示例4: mv_rtc_read_time

static int mv_rtc_read_time(struct rtc_time *tm)
{
	MV_RTC_TIME time;
	unsigned long temp_t;

	mvRtcDS1339TimeGet(&time);
	/* same as in the U-Boot we use the year for century 20 only */
	temp_t = mktime ( time.year + 2000, time.month,
        			time.date, time.hours,
        			time.minutes, time.seconds);
	rtc_time_to_tm(temp_t, tm);
	
	return 0;
}
开发者ID:KevinCabana,项目名称:xpenology,代码行数:14,代码来源:rtc.c


示例5: test_wakealarm

static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state)
{
	static char err_readtime[] __initdata =
		KERN_ERR "PM: can't read %s time, err %d\n";
	static char err_wakealarm [] __initdata =
		KERN_ERR "PM: can't set %s wakealarm, err %d\n";
	static char err_suspend[] __initdata =
		KERN_ERR "PM: suspend test failed, error %d\n";
	static char info_test[] __initdata =
		KERN_INFO "PM: test RTC wakeup from '%s' suspend\n";

	unsigned long		now;
	struct rtc_wkalrm	alm;
	int			status;

	
	status = rtc_read_time(rtc, &alm.time);
	if (status < 0) {
		printk(err_readtime, dev_name(&rtc->dev), status);
		return;
	}
	rtc_tm_to_time(&alm.time, &now);

	memset(&alm, 0, sizeof alm);
	rtc_time_to_tm(now + TEST_SUSPEND_SECONDS, &alm.time);
	alm.enabled = true;

	status = rtc_set_alarm(rtc, &alm);
	if (status < 0) {
		printk(err_wakealarm, dev_name(&rtc->dev), status);
		return;
	}

	if (state == PM_SUSPEND_MEM) {
		printk(info_test, pm_states[state]);
		status = pm_suspend(state);
		if (status == -ENODEV)
			state = PM_SUSPEND_STANDBY;
	}
	if (state == PM_SUSPEND_STANDBY) {
		printk(info_test, pm_states[state]);
		status = pm_suspend(state);
	}
	if (status < 0)
		printk(err_suspend, status);

	alm.enabled = false;
	rtc_set_alarm(rtc, &alm);
}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:49,代码来源:suspend_test.c


示例6: pm8xxx_rtc_read_time

static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
	int rc;
	u8 value[NUM_8_BIT_RTC_REGS], reg;
	unsigned long secs;
	struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev);

	rc = pm8xxx_read_wrapper(rtc_dd, value, rtc_dd->rtc_read_base,
							NUM_8_BIT_RTC_REGS);
	if (rc < 0) {
		dev_err(dev, "RTC read data register failed\n");
		return rc;
	}

	/*
	 * Read the LSB again and check if there has been a carry over.
	 * If there is, redo the read operation.
	 */
	rc = pm8xxx_read_wrapper(rtc_dd, &reg, rtc_dd->rtc_read_base, 1);
	if (rc < 0) {
		dev_err(dev, "RTC read data register failed\n");
		return rc;
	}

	if (unlikely(reg < value[0])) {
		rc = pm8xxx_read_wrapper(rtc_dd, value,
				rtc_dd->rtc_read_base, NUM_8_BIT_RTC_REGS);
		if (rc < 0) {
			dev_err(dev, "RTC read data register failed\n");
			return rc;
		}
	}

	secs = value[0] | (value[1] << 8) | (value[2] << 16) | (value[3] << 24);

	rtc_time_to_tm(secs, tm);

	rc = rtc_valid_tm(tm);
	if (rc < 0) {
		dev_err(dev, "Invalid time read from RTC\n");
		return rc;
	}

	dev_dbg(dev, "secs = %lu, h:m:s == %d:%d:%d, d/m/y = %d/%d/%d\n",
				secs, tm->tm_hour, tm->tm_min, tm->tm_sec,
				tm->tm_mday, tm->tm_mon, tm->tm_year);

	return 0;
}
开发者ID:LiquidSmooth-Devices,项目名称:Deathly_Kernel_D2,代码行数:49,代码来源:rtc-pm8xxx.c


示例7: omap_rtc_power_off

/*
 * omap_rtc_poweroff: RTC-controlled power off
 *
 * The RTC can be used to control an external PMIC via the pmic_power_en pin,
 * which can be configured to transition to OFF on ALARM2 events.
 *
 * Notes:
 * The two-second alarm offset is the shortest offset possible as the alarm
 * registers must be set before the next timer update and the offset
 * calculation is too heavy for everything to be done within a single access
 * period (~15 us).
 *
 * Called with local interrupts disabled.
 */
static void omap_rtc_power_off(void)
{
	struct omap_rtc *rtc = omap_rtc_power_off_rtc;
	struct rtc_time tm;
	unsigned long now;
	u32 val;

	rtc->type->unlock(rtc);
	/* enable pmic_power_en control */
	val = rtc_readl(rtc, OMAP_RTC_PMIC_REG);
	rtc_writel(rtc, OMAP_RTC_PMIC_REG, val | OMAP_RTC_PMIC_POWER_EN_EN);

	/* set alarm two seconds from now */
	omap_rtc_read_time_raw(rtc, &tm);
	bcd2tm(&tm);
	rtc_tm_to_time(&tm, &now);
	rtc_time_to_tm(now + 2, &tm);

	if (tm2bcd(&tm) < 0) {
		dev_err(&rtc->rtc->dev, "power off failed\n");
		return;
	}

	rtc_wait_not_busy(rtc);

	rtc_write(rtc, OMAP_RTC_ALARM2_SECONDS_REG, tm.tm_sec);
	rtc_write(rtc, OMAP_RTC_ALARM2_MINUTES_REG, tm.tm_min);
	rtc_write(rtc, OMAP_RTC_ALARM2_HOURS_REG, tm.tm_hour);
	rtc_write(rtc, OMAP_RTC_ALARM2_DAYS_REG, tm.tm_mday);
	rtc_write(rtc, OMAP_RTC_ALARM2_MONTHS_REG, tm.tm_mon);
	rtc_write(rtc, OMAP_RTC_ALARM2_YEARS_REG, tm.tm_year);

	/*
	 * enable ALARM2 interrupt
	 *
	 * NOTE: this fails on AM3352 if rtc_write (writeb) is used
	 */
	val = rtc_read(rtc, OMAP_RTC_INTERRUPTS_REG);
	rtc_writel(rtc, OMAP_RTC_INTERRUPTS_REG,
			val | OMAP_RTC_INTERRUPTS_IT_ALARM2);
	rtc->type->lock(rtc);

	/*
	 * Wait for alarm to trigger (within two seconds) and external PMIC to
	 * power off the system. Add a 500 ms margin for external latencies
	 * (e.g. debounce circuits).
	 */
	mdelay(2500);
}
开发者ID:forgivemyheart,项目名称:linux,代码行数:63,代码来源:rtc-omap.c


示例8: eemcs_sysfs_show_statistics

static ssize_t eemcs_sysfs_show_statistics(struct device *dev, struct device_attribute *attr, char *buf)
{
    int i = 0;
    char line[121]={0};
    char c_time_string[30]={0};
    int pos = 0;
    struct timeval	tv;
    struct rtc_time tm;
    struct rtc_time tm_now;
    do_gettimeofday(&tv);
    rtc_time_to_tm(tv.tv_sec,&tm_now);
    rtc_time_to_tm(eemcs_statistics[0]->time.tv_sec,&tm);
    sprintf(c_time_string,"%04d-%02d-%02d_%02d:%02d:%02d ~ %02d:%02d - %d sec",
        tm.tm_year+1900,tm.tm_mon+1, tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec,
        tm_now.tm_min,tm_now.tm_sec,
        (unsigned int)(tv.tv_sec - eemcs_statistics[0]->time.tv_sec));
    
    pos += sprintf(buf+pos, "Record Time: %s\n", c_time_string);
    
    pos += sprintf(buf+pos, "%15s | %7s | %7s | %9s | %8s | %8s | %7s | %7s |\n", 
        "CCCI PORT", "TX CNT", "RX CNT", "RX Q(MAX)", "TX TOTAL", "RX TOTAL", "TX DROP", "RX DROP");
    memset(line, '=', 91);
    pos += sprintf(buf+pos, "%s\n", line);
    for (i=0; i< CCCI_PORT_NUM_MAX; i++){
        CCCI_PORT_STATISTICS *port = &eemcs_statistics[0]->port[i];
        CCCI_PORT_STATISTICS *port_total = &eemcs_statistics[0]->port_total[i];
        pos += sprintf(buf+pos, "%15s | %7d | %7d | %3d(%4d) | %8d | %8d | %7d | %7d |\n", 
            ccci_port_name[i], port->cnt[TX], port->cnt[RX],
            port->queue[RX], port_total->queue[RX],
            port_total->cnt[TX], port_total->cnt[RX],
            port_total->drop[TX], port_total->drop[RX]
        );
    }
    
    return pos;
}
开发者ID:4Fwolf,项目名称:motorola-hawk-kernel-3.4.67,代码行数:36,代码来源:eemcs_sysfs.c


示例9: balong_rtc_readalarm

/**
 * balong_rtc_readalarm-read rtc alarm
 */
s32 balong_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alarm)
{
	rtc_time_to_tm(readl(g_rtc_ctrl.rtc_base_addr + HI_RTC_CMR_OFFSET), &alarm->time);
    alarm->pending = readl(g_rtc_ctrl.rtc_base_addr + HI_RTC_CCR_OFFSET) & RTC_BIT_AI;
    if(readl(g_rtc_ctrl.rtc_base_addr + HI_RTC_CCR_OFFSET)&RTC_BIT_IM)
    {
        alarm->enabled = ALARM_DISABLED;
    }
    else
    {
        alarm->enabled = ALARM_ENABLE;
    }

	return BSP_OK;
}
开发者ID:fly2436732935,项目名称:android_kernel_honor7_PLK-AL10_PLK-TL01H_PLK-UL00_PLK-CL00_PLK-TL00,代码行数:18,代码来源:rtc_balong.c


示例10: alarm_set_rtc_ring

int alarm_set_rtc_ring(struct timespec alarm_time)
{
    struct rtc_wkalrm   rtc_alarm;
    unsigned long       rtc_alarm_time;

    if (pwr_rtc_dev != NULL) {
        rtc_alarm_time = alarm_time.tv_sec;
        pr_alarm(INT, "%s, alarm time: %lu\n",
                 __func__, rtc_alarm_time);
        rtc_time_to_tm(rtc_alarm_time, &rtc_alarm.time);
        rtc_alarm.enabled = 1;
        rtc_set_alarm(pwr_rtc_dev, &rtc_alarm);
    }
    return 0;
}
开发者ID:dflow81,项目名称:android_kernel_samsung_goyawifi,代码行数:15,代码来源:alarm-dev.c


示例11: puv3_rtc_getalarm

static int puv3_rtc_getalarm(struct device *dev, struct rtc_wkalrm *alrm)
{
	struct rtc_time *alm_tm = &alrm->time;

	rtc_time_to_tm(readl(RTC_RTAR), alm_tm);

	alrm->enabled = readl(RTC_RTSR) & RTC_RTSR_ALE;

	pr_debug("read alarm %02x %02x.%02x.%02x %02x/%02x/%02x\n",
		 alrm->enabled,
		 alm_tm->tm_year, alm_tm->tm_mon, alm_tm->tm_mday,
		 alm_tm->tm_hour, alm_tm->tm_min, alm_tm->tm_sec);

	return 0;
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:15,代码来源:rtc-puv3.c


示例12: lpc32xx_rtc_read_alarm

static int lpc32xx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
{
	unsigned long alarmsecs;
	struct rtc_time *time = &wkalrm->time;
	struct platform_device *pdev = to_platform_device(dev);
	struct lpc32xx_rtc_priv *lpc32xx_rtc_dat = platform_get_drvdata(pdev);

	/* Read alarm match register */
	alarmsecs = __raw_readl(RTC_MATCH0(lpc32xx_rtc_dat->rtc_base));
	wkalrm->enabled = lpc32xx_rtc_dat->alarm_enabled;

	rtc_time_to_tm(alarmsecs, time);

	return 0;
}
开发者ID:athurg,项目名称:linux_kernel,代码行数:15,代码来源:rtc-lpc32xx.c


示例13: tegra_rtc_read_time

static int tegra_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
	NvU32 now;

	if (hPmu == NULL)
		return -1;

	if (!NvOdmPmuReadRtc(hPmu, &now)) {
		printk("NvOdmPmuReadRtc failed\n");
		return -1;
	}

	rtc_time_to_tm(now, tm);
	return 0;
}
开发者ID:BuzzBumbleBee,项目名称:android_kernel_advent_vega,代码行数:15,代码来源:rtc-tegra-odm.c


示例14: ls1x_rtc_read_time

static int ls1x_rtc_read_time(struct device *dev, struct rtc_time *rtm)
{
	unsigned long v, t;

	v = readl(SYS_TOYREAD0);
	t = readl(SYS_TOYREAD1);

	memset(rtm, 0, sizeof(struct rtc_time));
	t  = mktime((t & LS1X_YEAR_MASK), ls1x_get_month(v),
			ls1x_get_day(v), ls1x_get_hour(v),
			ls1x_get_min(v), ls1x_get_sec(v));
	rtc_time_to_tm(t, rtm);

	return 0;
}
开发者ID:the-snowwhite,项目名称:linux-socfpga,代码行数:15,代码来源:rtc-ls1x.c


示例15: set_wakealarm

static int set_wakealarm(void)
{
	int retval = 0;
	unsigned long now, alarm;
	struct rtc_wkalrm alm;
	struct rtc_device *rtc;

	rtc = rtc_class_open(CONFIG_WAKEALARM_RTC);
	if (!rtc) {
		return -1;
	}

	/* Only request alarms that trigger in the future.  Disable them
	 * by writing another time, e.g. 0 meaning Jan 1 1970 UTC.
	 */
	retval = rtc_read_time(rtc, &alm.time);
	if (retval < 0)
		goto close_rtc;
	rtc_tm_to_time(&alm.time, &now);

	alarm = now + sleep_time;
	
	if (alarm > now) {
		/* Avoid accidentally clobbering active alarms; we can't
		 * entirely prevent that here, without even the minimal
		 * locking from the /dev/rtcN api.
		 */
		retval = rtc_read_alarm(rtc, &alm);
		if (retval < 0)
			goto close_rtc;

		alm.enabled = 1;
	} else {
		alm.enabled = 0;

		/* Provide a valid future alarm time.  Linux isn't EFI,
		 * this time won't be ignored when disabling the alarm.
		 */
		alarm = now + 300;
	}

	rtc_time_to_tm(alarm, &alm.time);
	retval = rtc_set_alarm(rtc, &alm);

close_rtc:
	rtc_class_close(rtc);
	return retval;
}
开发者ID:qkdang,项目名称:m462,代码行数:48,代码来源:auto_sleep_wakeup_test.c


示例16: rs5c348_rtc_read_time

static int
rs5c348_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
	struct spi_device *spi = to_spi_device(dev);
	struct rs5c348_plat_data *pdata = dev_get_platdata(&spi->dev);
	u8 txbuf[5], rxbuf[7];
	int ret;

	/* Transfer 5 byte befores reading SEC.  This gives 31us for carry. */
	txbuf[0] = RS5C348_CMD_R(RS5C348_REG_CTL2); /* cmd, ctl2 */
	txbuf[1] = 0;	/* dummy */
	txbuf[2] = RS5C348_CMD_R(RS5C348_REG_CTL2); /* cmd, ctl2 */
	txbuf[3] = 0;	/* dummy */
	txbuf[4] = RS5C348_CMD_MR(RS5C348_REG_SECS); /* cmd, sec, ... */

	/* read in one transfer to avoid data inconsistency */
	ret = spi_write_then_read(spi, txbuf, sizeof(txbuf),
				  rxbuf, sizeof(rxbuf));
	udelay(62);	/* Tcsr 62us */
	if (ret < 0)
		return ret;

	tm->tm_sec = bcd2bin(rxbuf[RS5C348_REG_SECS] & RS5C348_SECS_MASK);
	tm->tm_min = bcd2bin(rxbuf[RS5C348_REG_MINS] & RS5C348_MINS_MASK);
	tm->tm_hour = bcd2bin(rxbuf[RS5C348_REG_HOURS] & RS5C348_HOURS_MASK);
	if (!pdata->rtc_24h) {
		if (rxbuf[RS5C348_REG_HOURS] & RS5C348_BIT_PM) {
			tm->tm_hour -= 20;
			tm->tm_hour %= 12;
			tm->tm_hour += 12;
		} else
			tm->tm_hour %= 12;
	}
	tm->tm_wday = bcd2bin(rxbuf[RS5C348_REG_WDAY] & RS5C348_WDAY_MASK);
	tm->tm_mday = bcd2bin(rxbuf[RS5C348_REG_DAY] & RS5C348_DAY_MASK);
	tm->tm_mon =
		bcd2bin(rxbuf[RS5C348_REG_MONTH] & RS5C348_MONTH_MASK) - 1;
	/* year is 1900 + tm->tm_year */
	tm->tm_year = bcd2bin(rxbuf[RS5C348_REG_YEAR]) +
		((rxbuf[RS5C348_REG_MONTH] & RS5C348_BIT_Y2K) ? 100 : 0);

	if (rtc_valid_tm(tm) < 0) {
		dev_err(&spi->dev, "retrieved date/time is not valid.\n");
		rtc_time_to_tm(0, tm);
	}

	return 0;
}
开发者ID:19Dan01,项目名称:linux,代码行数:48,代码来源:rtc-rs5c348.c


示例17: davinci_rtc_set_alarm

static int davinci_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
{
	struct davinci_rtc *davinci_rtc = dev_get_drvdata(dev);
	unsigned long flags;
	u16 days;

	if (alm->time.tm_mday <= 0 && alm->time.tm_mon < 0
	    && alm->time.tm_year < 0) {
		struct rtc_time tm;
		unsigned long now, then;

		davinci_rtc_read_time(dev, &tm);
		rtc_tm_to_time(&tm, &now);

		alm->time.tm_mday = tm.tm_mday;
		alm->time.tm_mon = tm.tm_mon;
		alm->time.tm_year = tm.tm_year;
		rtc_tm_to_time(&alm->time, &then);

		if (then < now) {
			rtc_time_to_tm(now + 24 * 60 * 60, &tm);
			alm->time.tm_mday = tm.tm_mday;
			alm->time.tm_mon = tm.tm_mon;
			alm->time.tm_year = tm.tm_year;
		}
	}

	if (convert2days(&days, &alm->time) < 0)
		return -EINVAL;

	spin_lock_irqsave(&davinci_rtc_lock, flags);

	davinci_rtcss_calendar_wait(davinci_rtc);
	rtcss_write(davinci_rtc, bin2bcd(alm->time.tm_min), PRTCSS_RTC_AMIN);

	davinci_rtcss_calendar_wait(davinci_rtc);
	rtcss_write(davinci_rtc, bin2bcd(alm->time.tm_hour), PRTCSS_RTC_AHOUR);

	davinci_rtcss_calendar_wait(davinci_rtc);
	rtcss_write(davinci_rtc, days & 0xFF, PRTCSS_RTC_ADAY0);

	davinci_rtcss_calendar_wait(davinci_rtc);
	rtcss_write(davinci_rtc, (days & 0xFF00) >> 8, PRTCSS_RTC_ADAY1);

	spin_unlock_irqrestore(&davinci_rtc_lock, flags);

	return 0;
}
开发者ID:AK101111,项目名称:linux,代码行数:48,代码来源:rtc-davinci.c


示例18: nx_rtc_ops_read_time

/*------------------------------------------------------------------------------
 * 	RTC OPS
 */
static int nx_rtc_ops_read_time(struct device *dev, struct rtc_time *tm)
{
	unsigned long rtc;

	spin_lock_irq(&rtc_lock);

	rtc = NX_RTC_GetRTCCounter();
	rtc_time_to_tm(rtc + rtc_time_offs, tm);
	DBGOUT("read time %04d.%02d.%02d %02d/%02d/%02d, rtc 0x%x\n",
		 tm->tm_year, tm->tm_mon, tm->tm_mday,
		 tm->tm_hour, tm->tm_min, tm->tm_sec, (u_int)rtc);

	spin_unlock_irq(&rtc_lock);

	return 0;
}
开发者ID:vlasenko,项目名称:kernel.rk,代码行数:19,代码来源:rtc-nexell.c


示例19: datetime_proc_show

static int datetime_proc_show(struct seq_file *m, void *v)
{
	struct timeval time;
	unsigned long local_time;
	struct rtc_time tm;

	do_gettimeofday(&time);
	local_time = (u32)(time.tv_sec - (sys_tz.tz_minuteswest * 60));
	rtc_time_to_tm(local_time, &tm);

	seq_printf(m, "%04d.%02d.%02d %02d:%02d:%02d\n",
		tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
		tm.tm_hour, tm.tm_min, tm.tm_sec);

	return 0;
}
开发者ID:rafaelnp,项目名称:llkdd,代码行数:16,代码来源:datetime.c


示例20: pcap_rtc_read_time

static int pcap_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
	struct pcap_rtc *pcap_rtc = dev_get_drvdata(dev);
	unsigned long secs;
	u32 tod, days;

	ezx_pcap_read(pcap_rtc->pcap, PCAP_REG_RTC_TOD, &tod);
	secs = tod & PCAP_RTC_TOD_MASK;

	ezx_pcap_read(pcap_rtc->pcap, PCAP_REG_RTC_DAY, &days);
	secs += (days & PCAP_RTC_DAY_MASK) * SEC_PER_DAY;

	rtc_time_to_tm(secs, tm);

	return 0;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:16,代码来源:rtc-pcap.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ rtc_tm_to_time函数代码示例发布时间:2022-05-30
下一篇:
C++ rtc_set_time函数代码示例发布时间: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