blob: e638aa89afc76d53e0fa5801c780ce96a7aaa2c3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#pragma once
#include <Poco/Timestamp.h>
#include <string>
#include <filesystem>
#include <Common/filesystemHelpers.h>
class FileUpdatesTracker
{
private:
std::string path;
Poco::Timestamp known_time;
public:
explicit FileUpdatesTracker(const std::string & path_)
: path(path_)
, known_time(0)
{}
bool isModified() const
{
return getLastModificationTime() > known_time;
}
void fixCurrentVersion()
{
known_time = getLastModificationTime();
}
private:
Poco::Timestamp getLastModificationTime() const
{
return FS::getModificationTimestamp(path);
}
};
|