Convert Date-Time to Milliseconds - C++ - cross platform
问题 I want to convert a string in the format of "20160907-05:00:54.123" into milliseconds. I know that strptime is not available in Windows and I want to run my program in both windows and linux. I can't use third party libraries as well. I can tokenize the string and convert it. But is there a more elegant way like using the strptime to do so? 回答1: Given the format of your string, it is fairly easy to parse it as follows (although a regex or get_time might be more elegant): tm t; t.tm_year =