How to get file access times in Haskell (cross-platform)?

1.2k Views Asked by At

I'd like to read file access times in a portable way. I found accessTime in System.Posix.Files, but it's POSIX only. Is there a portable, cross-platform way that would work both on Windows and POSIX systems?

4

There are 4 best solutions below

1
On

How about System.Directory.getModificationTime for modification time? For access time I'm not sure there is a portable way.

2
On

You can use unix-compat to get both Windows and POSIX support for a lot of the functionality in the unix package.

0
On

On Windows you can use System.Win32.getFileTime function, second time - is last access time. How i know - no crossplatform way for this task.

0
On

As of directory-1.2.3 there is now System.Directory.getAccessTime.