summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp16
-rw-r--r--vespalib/src/vespa/fastlib/io/bufferedfile.cpp7
-rw-r--r--vespalib/src/vespa/fastlib/io/bufferedfile.h2
-rw-r--r--vespalib/src/vespa/fastos/file.h4
-rw-r--r--vespalib/src/vespa/fastos/unix_file.cpp6
-rw-r--r--vespalib/src/vespa/fastos/unix_file.h2
6 files changed, 18 insertions, 19 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);
diff --git a/vespalib/src/vespa/fastlib/io/bufferedfile.cpp b/vespalib/src/vespa/fastlib/io/bufferedfile.cpp
index 31ca735a0bb..3f02a30e1c4 100644
--- a/vespalib/src/vespa/fastlib/io/bufferedfile.cpp
+++ b/vespalib/src/vespa/fastlib/io/bufferedfile.cpp
@@ -107,11 +107,10 @@ Fast_BufferedFile::Sync()
return _file->Sync();
}
-time_t
-Fast_BufferedFile::GetModificationTime()
+vespalib::system_time
+Fast_BufferedFile::getModificationTime()
{
- time_t retval = _file->GetModificationTime();
- return retval;
+ return _file->getModificationTime();
}
void
diff --git a/vespalib/src/vespa/fastlib/io/bufferedfile.h b/vespalib/src/vespa/fastlib/io/bufferedfile.h
index 48f90262ad9..748fa6fd06c 100644
--- a/vespalib/src/vespa/fastlib/io/bufferedfile.h
+++ b/vespalib/src/vespa/fastlib/io/bufferedfile.h
@@ -177,7 +177,7 @@ public:
*
* @return time_t The last modification time.
*/
- time_t GetModificationTime() override;
+ vespalib::system_time getModificationTime() override;
/**
* Turn on direct IO.
*/
diff --git a/vespalib/src/vespa/fastos/file.h b/vespalib/src/vespa/fastos/file.h
index 146127d4fe6..d2c290360e8 100644
--- a/vespalib/src/vespa/fastos/file.h
+++ b/vespalib/src/vespa/fastos/file.h
@@ -10,7 +10,7 @@
#pragma once
-#include <cstdint>
+#include <vespa/vespalib/util/time.h>
#include <string>
#define FASTOS_PREFIX(a) FastOS_##a
@@ -347,7 +347,7 @@ public:
* Return the time when file was last modified.
* @return time of last modification
*/
- virtual time_t GetModificationTime() = 0;
+ virtual vespalib::system_time getModificationTime() = 0;
/**
* Delete the file. This method requires that the file is
diff --git a/vespalib/src/vespa/fastos/unix_file.cpp b/vespalib/src/vespa/fastos/unix_file.cpp
index 7c4cde19125..8f7d4eb8bec 100644
--- a/vespalib/src/vespa/fastos/unix_file.cpp
+++ b/vespalib/src/vespa/fastos/unix_file.cpp
@@ -345,8 +345,8 @@ FastOS_UNIX_File::GetSize()
}
-time_t
-FastOS_UNIX_File::GetModificationTime()
+vespalib::system_time
+FastOS_UNIX_File::getModificationTime()
{
struct stat stbuf{};
assert(IsOpened());
@@ -355,7 +355,7 @@ FastOS_UNIX_File::GetModificationTime()
assert(res == 0);
(void) res;
- return stbuf.st_mtime;
+ return vespalib::system_time(vespalib::duration(stbuf.st_mtim.tv_sec*1000*1000*1000 + stbuf.st_mtim.tv_nsec));
}
diff --git a/vespalib/src/vespa/fastos/unix_file.h b/vespalib/src/vespa/fastos/unix_file.h
index 31e45f8d2fa..b19279caa05 100644
--- a/vespalib/src/vespa/fastos/unix_file.h
+++ b/vespalib/src/vespa/fastos/unix_file.h
@@ -82,7 +82,7 @@ public:
bool SetPosition(int64_t desiredPosition) override;
int64_t GetPosition() override;
int64_t GetSize() override;
- time_t GetModificationTime() override;
+ vespalib::system_time getModificationTime() override;
bool Delete() override;
[[nodiscard]] bool Sync() override;
bool SetSize(int64_t newSize) override;