summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-03-01 10:55:48 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-03-01 10:55:48 +0000
commit4632b860d1576d049b1c86741b05443beb26e379 (patch)
tree0d11d934532b98322d26132d597f6279c8b8827f /searchcore
parent31db1c671fac8e34f098f9d6d9797c2c1e05d433 (diff)
Use typesafe time for file modification time.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp
index f22f57979b4..c16a89f4e2b 100644
--- a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp
@@ -94,9 +94,9 @@ class ConfigFile
{
using SP = std::shared_ptr<ConfigFile>;
- vespalib::string _name;
- time_t _modTime;
- std::vector<char> _content;
+ vespalib::string _name;
+ vespalib::system_time _modTime;
+ std::vector<char> _content;
public:
ConfigFile();
@@ -111,7 +111,7 @@ public:
ConfigFile::ConfigFile()
: _name(),
- _modTime(0),
+ _modTime(),
_content()
{
}
@@ -120,7 +120,7 @@ ConfigFile::~ConfigFile() = default;
ConfigFile::ConfigFile(const vespalib::string &name, const vespalib::string &fullName)
: _name(name),
- _modTime(0),
+ _modTime(),
_content()
{
FastOS_File file;
@@ -130,7 +130,7 @@ ConfigFile::ConfigFile(const vespalib::string &name, const vespalib::string &ful
int64_t fileSize = file.getSize();
_content.resize(fileSize);
file.ReadBuf(_content.data(), fileSize);
- _modTime = file.GetModificationTime();
+ _modTime = file.getModificationTime();
}
nbostream &
@@ -138,7 +138,7 @@ ConfigFile::serialize(nbostream &stream) const
{
assert(strchr(_name.c_str(), '/') == nullptr);
stream << _name;
- stream << static_cast<int64_t>(_modTime);;
+ stream << vespalib::count_s(_modTime.time_since_epoch());
uint32_t sz = _content.size();
stream << sz;
stream.write(_content.data(), sz);
@@ -152,7 +152,7 @@ ConfigFile::deserialize(nbostream &stream)
assert(strchr(_name.c_str(), '/') == nullptr);
int64_t modTime;
stream >> modTime;
- _modTime = modTime;
+ _modTime = vespalib::system_time(vespalib::from_s(modTime));
uint32_t sz;
stream >> sz;
_content.resize(sz);