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