//盗墓者是个丑奴儿,原
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
//结构体转为毫秒,返回time_t 类型
time_t Transformation(struct tm t){
return mktime(&t);
}
int main(void){
struct tm t1={0};
struct tm t2={0};
t1.tm_year=2018;
t1.tm_mon=7;
t1.tm_mday=21;
t2.tm_year=2019;
t2.tm_mon=7;
t2.tm_mday=21;
time_t t1_l=Transformation(t1);
time_t

该博客介绍如何在C语言中通过结构体和mktime函数比较两个日期的大小,示例代码展示了设置结构体参数,转换为毫秒后进行比较的过程。
最低0.47元/天 解锁文章
395

被折叠的 条评论
为什么被折叠?



