MCPcopy Create free account
hub / github.com/boostorg/filesystem / to_FILETIME

Function to_FILETIME

src/operations.cpp:1527–1543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1525}
1526
1527inline DWORD to_FILETIME(std::time_t t, FILETIME& ft)
1528{
1529 // On Windows, time_t is signed, and negative values are possible since FILETIME epoch is earlier than POSIX epoch
1530 int64_t st = static_cast< int64_t >(t);
1531 if (BOOST_UNLIKELY(st < ((std::numeric_limits< int64_t >::min)() / 10000000 - 11644473600ll) ||
1532 st > ((std::numeric_limits< int64_t >::max)() / 10000000 - 11644473600ll)))
1533 {
1534 return ERROR_INVALID_DATA;
1535 }
1536
1537 st = (st + 11644473600ll) * 10000000;
1538 uint64_t ut = static_cast< uint64_t >(st);
1539 ft.dwLowDateTime = static_cast< DWORD >(ut);
1540 ft.dwHighDateTime = static_cast< DWORD >(ut >> 32u);
1541
1542 return 0u;
1543}
1544
1545} // unnamed namespace
1546

Callers 1

last_write_timeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected