Closed. This question is off-topic。它当前不接受答案。
想改善这个问题吗? Update the question,因此它是on-topic,用于堆栈溢出。
4年前关闭。
我有一个存储在结构中的日期和时间值。我想将其转换为时间戳(毫秒)。
我使用http://currentmillis.com/来获取上述日期和时间的毫秒值,并且它返回了以下值。
1452512670345
C中是否有可用的库函数将上述数据时间值转换为毫秒?
想改善这个问题吗? Update the question,因此它是on-topic,用于堆栈溢出。
4年前关闭。
我有一个存储在结构中的日期和时间值。我想将其转换为时间戳(毫秒)。
dt.year = 2016;
dt.month = 01;
dt.date = 11;
dt.hour = 17;
dt.minute = 14;
dt.seconds = 30;
dt.milliseconds = 345;
我使用http://currentmillis.com/来获取上述日期和时间的毫秒值,并且它返回了以下值。
1452512670345
C中是否有可用的库函数将上述数据时间值转换为毫秒?
最佳答案
mktime
将struct tm
转换为Unix时间戳(以秒为单位)。乘以1000
并将多余的毫秒数加到结果中。
关于c - 将日期和时间转换为毫秒,以C为单位,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34720891/