filesystemTimestampGranularity

Undocumented in source.
  1. enum filesystemTimestampGranularity;
  2. enum filesystemTimestampGranularity;
  3. enum filesystemTimestampGranularity;
  4. enum filesystemTimestampGranularity;
    version(!Windows && !OSX)
    package
    static if(!(__VERSION__ > 2_072))
    enum filesystemTimestampGranularity = 1.seconds;

Examples

import std.file;
static void[] readProxy(string fn) { return std.file.read(fn); }

enum FN = "test.txt";
auto cachedData = FileCache!readProxy(FN);

std.file.write(FN, "One");
scope(exit) remove(FN);
assert(cachedData == "One");

Thread.sleep(filesystemTimestampGranularity);
std.file.write(FN, "Two");
assert(cachedData == "Two");
auto mtime = FN.timeLastModified();

version (OSX) {} else // setTimes does not work on macOS 10.15 ?
{
	Thread.sleep(filesystemTimestampGranularity);
	std.file.write(FN, "Three");
	FN.setTimes(mtime, mtime);
	assert(cachedData == "Two");
}

Meta