2012-10-05 23:55:07 +04:00
|
|
|
/*============================================================================
|
|
|
|
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
|
|
|
|
|
2016-04-29 16:40:20 +03:00
|
|
|
#include "cmStandardIncludes.h"
|
|
|
|
|
2012-10-05 23:55:07 +04:00
|
|
|
#include <string>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
/** \class cmTimestamp
|
2016-02-16 23:48:56 +03:00
|
|
|
* \brief Utility class to generate string representation of a timestamp
|
2012-10-05 23:55:07 +04:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
class cmTimestamp
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmTimestamp() {}
|
|
|
|
|
|
|
|
std::string CurrentTime(const std::string& formatString, bool utcFlag);
|
|
|
|
|
|
|
|
std::string FileModificationTime(const char* path,
|
2016-05-16 17:34:04 +03:00
|
|
|
const std::string& formatString,
|
|
|
|
bool utcFlag);
|
2012-10-05 23:55:07 +04:00
|
|
|
|
|
|
|
private:
|
2016-02-16 23:48:56 +03:00
|
|
|
time_t CreateUtcTimeTFromTm(struct tm& timeStruct) const;
|
2012-10-05 23:55:07 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string CreateTimestampFromTimeT(time_t timeT, std::string formatString,
|
|
|
|
bool utcFlag) const;
|
2016-02-16 23:48:56 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string AddTimestampComponent(char flag, struct tm& timeStruct,
|
|
|
|
time_t timeT) const;
|
2012-10-05 23:55:07 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|