⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gettime.c

📁 linux下RTC应用程序编写例子程序。 实现了gettime
💻 C
字号:
/* Gettime.c version 1.3.22 *//* written by kena,HHTECH */#include <stdio.h>#include <stdlib.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>//#include <linux/rtc.h>//#include <asm-arm/ioctl.h>struct rtc_time {	    int tm_sec;		    int tm_min;			    int tm_hour;				    int tm_mday;					    int tm_mon;						    int tm_year;							    int tm_wday;								    int tm_yday;									    int tm_isdst;};int main(int argc,char** argv){	int fd,length;	char inputchar;	struct rtc_time haha;	struct rtc_time *rtctime=&haha;	/* this file is used like this:gettime */	fd=open("/dev/misc/rtc",O_RDWR);	ioctl(fd,0x80247009,rtctime);	//ioctl(fd,RTC_RD_TIME,rtctime);	printf("RTC TIME now=%04d,%02d,%02d,%02d:%02d:%02d\n",rtctime->tm_year,rtctime->tm_mon,rtctime->tm_mday,rtctime->tm_hour,rtctime->tm_min,rtctime->tm_sec);	close(fd);	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -