姬長信(Redy)

C将时间字符串转换为纪元的秒数


我有一个字符串,格式如下:

2010-11-04T23:23:01Z

Z表示时间是UTC.
我宁愿将其存储为一个时间点,以便比较容易.

这样做的推荐方法是什么?

目前(在quck搜索之后),简化算法是:

1: 
2: Use mktime() to convert struct_tm to epoch time.

// Problem here is that mktime uses local time not UTC time.