libcryfs/test/fspp/fuse/utimens/testutils/FuseUtimensTest.cpp
Sebastian Messmer 9ccb006f61 - Switch some CI jobs to clang 15
- Fix clang-tidy warnings from Clang 15
2023-07-08 14:48:59 -07:00

23 lines
761 B
C++

#include "FuseUtimensTest.h"
#include <cpp-utils/system/filetime.h>
void FuseUtimensTest::Utimens(const char *filename, timespec lastAccessTime, timespec lastModificationTime) {
const int error = UtimensReturnError(filename, lastAccessTime, lastModificationTime);
EXPECT_EQ(0, error);
}
int FuseUtimensTest::UtimensReturnError(const char *filename, timespec lastAccessTime, timespec lastModificationTime) {
auto fs = TestFS();
auto realpath = fs->mountDir() / filename;
return cpputils::set_filetime(realpath.string().c_str(), lastAccessTime, lastModificationTime);
}
struct timespec FuseUtimensTest::makeTimespec(time_t tv_sec, long tv_nsec) {
struct timespec result{};
result.tv_sec = tv_sec;
result.tv_nsec = tv_nsec;
return result;
}