2016-09-27 19:01:08 +00:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2012-10-05 19:55:07 +00:00
|
|
|
#ifndef cmTimestamp_h
|
|
|
|
#define cmTimestamp_h
|
|
|
|
|
2016-11-05 20:40:14 +00:00
|
|
|
#include <cmConfigure.h> // IWYU pragma: keep
|
2016-04-29 13:40:20 +00:00
|
|
|
|
2012-10-05 19:55:07 +00:00
|
|
|
#include <string>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
/** \class cmTimestamp
|
2016-02-16 20:48:56 +00:00
|
|
|
* \brief Utility class to generate string representation of a timestamp
|
2012-10-05 19:55:07 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
class cmTimestamp
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmTimestamp() {}
|
|
|
|
|
|
|
|
std::string CurrentTime(const std::string& formatString, bool utcFlag);
|
|
|
|
|
|
|
|
std::string FileModificationTime(const char* path,
|
2016-05-16 14:34:04 +00:00
|
|
|
const std::string& formatString,
|
|
|
|
bool utcFlag);
|
2012-10-05 19:55:07 +00:00
|
|
|
|
|
|
|
private:
|
2016-02-16 20:48:56 +00:00
|
|
|
time_t CreateUtcTimeTFromTm(struct tm& timeStruct) const;
|
2012-10-05 19:55:07 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
std::string CreateTimestampFromTimeT(time_t timeT, std::string formatString,
|
|
|
|
bool utcFlag) const;
|
2016-02-16 20:48:56 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
std::string AddTimestampComponent(char flag, struct tm& timeStruct,
|
|
|
|
time_t timeT) const;
|
2012-10-05 19:55:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|