In this note I'll first introduce some operation to the system clock and then I'll share some information about string operations.
1. Time
head files, I recently learnt two useful head files about system clock and time format. A) <chrono> and B) <time.h>. For the specific, see the example below:
the result is:
Important points here is: time_point and time_t classes have different formats, and you can use the function: to_time_t to convert the format from time_point to time_t. There is also from_time_t to do the inverse conversion.
Another important function in the example is ctime_s. It requires three input parameters:
1) a vector that stores the time information; 2) the size of the vector; 3) the pointer pointing to the variable contains the time information in a time_t format.
Useful links:
http://www.cplusplus.com/reference/chrono/time_point/
http://www.cplusplus.com/reference/chrono/system_clock/to_time_t/
http://www.cplusplus.com/reference/chrono/system_clock/now/
http://www.cplusplus.com/reference/chrono/system_clock/from_time_t/
2. String
First I'm going to introduce the class ostringstream. Ostringstream is a keyword defined by standard namespace and included in the header <sstream>. The class ostringstream uses a string buffer to store a sequence of characters which can be accessed using the string object(_.str).
result:
There is also istringstream and stringstream, you can find more information
here: http://www.cnblogs.com/gamesky/archive/2013/01/09/2852356.html
Useful link:
http://www.cplusplus.com/reference/sstream/ostringstream/
http://blog.csdn.net/qq1987924/article/details/7671154