MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / touchFile

Function touchFile

src/common/os/win32/os_utils.cpp:331–351  ·  view source on GitHub ↗

set file's last access and modification time to current time

Source from the content-addressed store, hash-verified

329
330// set file's last access and modification time to current time
331bool touchFile(const char* pathname)
332{
333 FILETIME ft;
334 SYSTEMTIME st;
335
336 HANDLE hFile = CreateFile(pathname,
337 GENERIC_READ | FILE_WRITE_ATTRIBUTES,
338 FILE_SHARE_READ | FILE_SHARE_WRITE,
339 ISC_get_security_desc(),
340 OPEN_EXISTING,
341 FILE_ATTRIBUTE_NORMAL,
342 0);
343 if (hFile == INVALID_HANDLE_VALUE)
344 return false;
345
346 GetSystemTime(&st);
347 const bool ret = SystemTimeToFileTime(&st, &ft) && SetFileTime(hFile, NULL, &ft, &ft);
348 CloseHandle(hFile);
349
350 return ret;
351}
352
353// check if OS have support for IPv6 protocol
354bool isIPv6supported()

Callers

nothing calls this directly

Calls 3

ISC_get_security_descFunction · 0.85
GetSystemTimeFunction · 0.85
SystemTimeToFileTimeFunction · 0.85

Tested by

no test coverage detected