diff options
author | Nils Gladitz <gladitz@scivis.de> | 2012-10-05 19:55:07 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2012-12-05 15:39:10 (GMT) |
commit | 711e2b3b5c674d4f754b5b214d511be6ce7e8f4d (patch) | |
tree | eac34a0d730f835f60e4fb28cc0e039c30298d3d /Source/cmTimestamp.h | |
parent | 2bb2745fa8c260d12aca33d2e1fd26a92d3bfa6b (diff) | |
download | CMake-711e2b3b5c674d4f754b5b214d511be6ce7e8f4d.zip CMake-711e2b3b5c674d4f754b5b214d511be6ce7e8f4d.tar.gz CMake-711e2b3b5c674d4f754b5b214d511be6ce7e8f4d.tar.bz2 |
CMake: Add TIMESTAMP subcommand to string and file commands
Diffstat (limited to 'Source/cmTimestamp.h')
-rw-r--r-- | Source/cmTimestamp.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Source/cmTimestamp.h b/Source/cmTimestamp.h new file mode 100644 index 0000000..24c1869 --- /dev/null +++ b/Source/cmTimestamp.h @@ -0,0 +1,40 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmTimestamp_h +#define cmTimestamp_h + +#include <string> +#include <time.h> + +/** \class cmTimestamp + * \brief Utility class to generate sting representation of a timestamp + * + */ +class cmTimestamp +{ +public: + cmTimestamp() {} + + std::string CurrentTime(const std::string& formatString, bool utcFlag); + + std::string FileModificationTime(const char* path, + const std::string& formatString, bool utcFlag); + +private: + std::string CreateTimestampFromTimeT(time_t timeT, + std::string formatString, bool utcFlag); + + std::string AddTimestampComponent(char flag, struct tm& timeStruct); +}; + + +#endif |