Changeset 8232 for code/trunk/src/libraries
- Timestamp:
- Apr 11, 2011, 7:37:00 PM (14 years ago)
- Location:
- code/trunk/src/libraries/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/util/StringUtils.cc
r7401 r8232 35 35 36 36 #include <cctype> 37 #include <ctime> 37 38 #include <boost/scoped_array.hpp> 38 39 #include "Convert.h" … … 516 517 return matrix[(rows-1)*cols + cols-1]; 517 518 } 519 520 /** 521 @brief 522 Get a timestamp for the curent time instant. 523 @return 524 Returns a string with the timestamp. 525 */ 526 std::string getTimestamp(void) 527 { 528 struct tm *pTime; 529 time_t ctTime; std::time(&ctTime); 530 pTime = std::localtime( &ctTime ); 531 std::ostringstream oss; 532 oss << std::setw(2) << std::setfill('0') << (pTime->tm_mon + 1) 533 << std::setw(2) << std::setfill('0') << pTime->tm_mday 534 << std::setw(2) << std::setfill('0') << (pTime->tm_year + 1900) 535 << "_" << std::setw(2) << std::setfill('0') << pTime->tm_hour 536 << std::setw(2) << std::setfill('0') << pTime->tm_min 537 << std::setw(2) << std::setfill('0') << pTime->tm_sec; 538 return oss.str(); 539 } 518 540 } -
code/trunk/src/libraries/util/StringUtils.h
r7417 r8232 48 48 extern _UtilExport std::string BLANKSTRING; 49 49 50 _UtilExport std::string getUniqueNumberString();50 _UtilExport std::string getUniqueNumberString(); 51 51 52 52 _UtilExport void strip(std::string* str); … … 88 88 89 89 _UtilExport unsigned int getLevenshteinDistance(const std::string& str1, const std::string& str2); 90 91 _UtilExport std::string getTimestamp(void); 90 92 } 91 93
Note: See TracChangeset
for help on using the changeset viewer.