File/Folder name to get times for.
Time the file/folder was last accessed.
Time the file/folder was last modified.
FileException on error.
import std.datetime : abs, SysTime; scope(exit) deleteme.remove; write(deleteme, "a"); SysTime accessTime, modificationTime; getTimes(deleteme, accessTime, modificationTime); import std.datetime : Clock, seconds; auto currTime = Clock.currTime(); enum leeway = 5.seconds; auto diffAccess = accessTime - currTime; auto diffModification = modificationTime - currTime; assert(abs(diffAccess) <= leeway); assert(abs(diffModification) <= leeway);
Get the access and modified times of file or folder name.