?? rtc_test.c
字號:
#include <time.h>#include <stdio.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <stdlib.h>#include <sys/ioctl.h>#include <errno.h>#include <asm/types.h>#include <linux/rtc.h>#include "../include/api.h"int main(int argc,const char * argv[]){ struct tm read_tm; struct tm t; t.tm_sec = 50; //0-59 t.tm_min = 59; //0-59 t.tm_hour = 23; //0-23 t.tm_mday = 25; //1-31 t.tm_mon = 1; //0-11 t.tm_wday = 1; //0-6 week day t.tm_year = 105; //0-199 2005-1900 //ds1302_set_time(&t); if(argc>1){ if(strcmp(argv[1],"w")==0){ printf("set new date time: \n"); ds1302_set_time(&t); rtc_set_time(&t); } } rtc_get_time(&read_tm); printf("AT91RM9200 rtc time: "); show_time(&read_tm); ds1302_get_time(&read_tm); printf("DS1302 rtc time: "); show_time(&read_tm);}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -