Windows to Linux Porting - timeCreated and timeLastAccessed

Vino vino.bheeman at
Fri May 4 11:49:24 UTC 2018

Hi All,

   Request your help, I have a D program written on Windows 
platform and the program is working as expected, now i am trying 
to port the same program to Linux, my program use the function 
"timeCreated" from std.file for Windows hugely where as in Linux 
we do not have the same function hence planned to use the 
function "timeLastAccessed" from std.file, so what is the best 
approach to port the program. I tried the below code but not 
working, so can you one please guide me on the right method to 
port the program to linux, below is the example code.

Example Code:
import std.stdio: writeln;
import std.container.array;
import std.file: dirEntries,isFile, SpanMode;
import std.algorithm: filter, map;
import std.typecons: Tuple, tuple;
import std.datetime.systime: SysTime;

version (Windows) { alias sTimeStamp = timeCreated; } else 
version (linux) { alias sTimeStamp = timeLastAccessed; }

auto clogClean (string LogDir ) {
Array!(Tuple!(string, SysTime)) dFiles;
  dFiles.insert(dirEntries(LogDir, SpanMode.shallow).filter!(a => 
a.isFile).map!(a => tuple(, a.sTimeStamp)));
  return dFiles;

void main () {
string LogDir;
LogDir = "//DScript/Test";       //  Error: undefined identifier 
timeLastAccessed on Linux
LogDir = "C:\\DScript\\Others";  //  Error: undefined identifier 
timeCreated on Windows.


More information about the Digitalmars-d-learn mailing list