cmake/Source/cmTimestamp.h

46 lines
1.4 KiB
C
Raw Normal View History

2013-03-16 19:13:01 +02: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-07-09 11:21:54 +02:00
#include "cmStandardIncludes.h"
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