#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> int ast_timeJudge(int start_h, int start_m , int end_h, int end_m){ time_t start, end, current; current = time(NULL); struct tm t = *localtime(¤t); struct tm t_e = *localtime(¤t); t.tm_hour = start_h; t.tm_min = start_m; t.tm_sec = 0; start= mktime(&t); t_e.tm_hour = end_h; t_e.tm_min = end_m; t_e.tm_sec = 0; end= mktime(&t_e); if(current <= end && current >= start){ return 1; } return 0; } main(){ int x = ast_timeJudge(0,0,23,23); }
发表评论