With C++11 you can now do
struct std::tm tm;
std::istringstream ss("16:35:12");
ss >> std::get_time(&tm, "%H:%M:%S"); // or just %T in this case
std::time_t time = mktime(&tm);
see std::get_time and strftime for reference
More Related Contents:
- How to find out the date of the first day of week from the week number in C++
- Easily measure elapsed time
- How to get current time and date in C++?
- How do I calculate the week number given a date?
- How can I measure CPU time and wall clock time on both Linux/Windows?
- What are the uses of std::chrono::high_resolution_clock?
- Convert Windows Filetime to second in Unix/Linux
- Extract year/month/day etc. from std::chrono::time_point in C++
- Measure execution time in C++ OpenMP code
- Outputting Date and Time in C++ using std::chrono
- Microsecond resolution timestamps on Windows
- Get current time in milliseconds using C++ and Boost
- How to implement timeout for function in c++
- How do you add a timed delay to a C++ program?
- How to compare two time stamp in format “Month Date hh:mm:ss” to check +ve or -ve value
- C++: Timing in Linux (using clock()) is out of sync (due to OpenMP?)
- C++ Converting a time string to seconds from the epoch
- Calculate system time using rdtsc
- Time difference in C++
- How to convert a time into epoch time?
- Return type of ‘?:’ (ternary conditional operator)
- Why is strncpy insecure?
- bool to int conversion
- Why are strings in C++ usually terminated with ‘\0’?
- Compile time triggered range check for std::vector
- Why do we require requires requires?
- Passing array of structures to function c++
- is it ok to specialize std::numeric_limits for user-defined number-like classes?
- Object oriented programming in Haskell
- Compiling Qt 4.8.x for Visual Studio 2012