cmake/Source/cmTimestamp.h

37 lines
1023 B
C
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
2013-03-16 19:13:01 +02:00
#ifndef cmTimestamp_h
#define cmTimestamp_h
2017-07-20 19:35:53 +02:00
#include "cmConfigure.h" // IWYU pragma: keep
2016-07-09 11:21:54 +02:00
2013-03-16 19:13:01 +02:00
#include <string>
#include <time.h>
/** \class cmTimestamp
2016-07-09 11:21:54 +02:00
* \brief Utility class to generate string representation of a timestamp
2013-03-16 19:13:01 +02:00
*
*/
class cmTimestamp
{
public:
cmTimestamp() {}
std::string CurrentTime(const std::string& formatString, bool utcFlag);
std::string FileModificationTime(const char* path,
2016-07-09 11:21:54 +02:00
const std::string& formatString,
bool utcFlag);
2013-03-16 19:13:01 +02:00
private:
2016-07-09 11:21:54 +02:00
time_t CreateUtcTimeTFromTm(struct tm& timeStruct) const;
2013-03-16 19:13:01 +02:00
2016-07-09 11:21:54 +02:00
std::string CreateTimestampFromTimeT(time_t timeT, std::string formatString,
bool utcFlag) const;
2013-03-16 19:13:01 +02:00
2016-07-09 11:21:54 +02:00
std::string AddTimestampComponent(char flag, struct tm& timeStruct,
time_t timeT) const;
};
2013-03-16 19:13:01 +02:00
#endif