nixpkgs/pkgs/applications/networking/instant-messengers/signalbackup-tools/apple-sdk-missing-utimensat.patch
2022-01-18 10:41:47 -08:00

35 lines
1.1 KiB
Diff

diff --git a/signalbackup/setfiletimestamp.cc b/signalbackup/setfiletimestamp.cc
index f53a168..d2d1c5e 100644
--- a/signalbackup/setfiletimestamp.cc
+++ b/signalbackup/setfiletimestamp.cc
@@ -21,24 +21,23 @@
#if !defined(_WIN32) && !defined(__MINGW64__)
-#include <fcntl.h>
-#include <sys/stat.h>
+#include <sys/time.h>
bool SignalBackup::setFileTimeStamp(std::string const &file, long long int time_usec) const
{
- struct timespec ntimes[] =
+ struct timeval ntimes[] =
{
{ // ntimes[0] =
time_usec / 1000, // tv_sec, seconds
- (time_usec % 1000) * 1000 // tv_usec, nanoseconds
+ static_cast<int>(time_usec) // tv_usec, nanoseconds
},
{ // ntimes[1] =
time_usec / 1000, // tv_sec, seconds
- (time_usec % 1000) * 1000 // tv_usec, nanoseconds
+ static_cast<int>(time_usec) // tv_usec, nanoseconds
}
};
- return (utimensat(AT_FDCWD, file.c_str(), ntimes, 0) == 0);
+ return (utimes(file.c_str(), ntimes) == 0);
}
#else // this is poorly tested, I don't have windows