I would like to get timestamp from date time format in C++. I wrote C style solution, but this->cache_time
doesn't promise \0
at the end because it is std::string_view
.
std::time_t client::get_cache_time() {
struct tm time;
if(strptime(this->cache_time.data(), "%a, %d %b %Y %X %Z", &time) != NULL) {
return timelocal(&time);
}
return 0;
}
Is there a strptime() alternative in c ++ what can work with std::string_view
?
Thank you for help.