Proposal: better timestamp granularity for modificationTime/setFileTimes in System.Posix.Files[.ByteString]

Marios Titas redneb8888 at
Wed Jun 13 10:24:15 CEST 2012

On Mon, Jun 11, 2012 at 7:14 PM, Marios Titas <redneb8888 at> wrote:
> On Mon, Jun 11, 2012 at 2:04 PM, Brandon Allbery <allbery.b at> wrote:
>> On Mon, Jun 11, 2012 at 9:25 AM, Marios Titas <redneb8888 at> wrote:
>>> System.Posix.Files[.ByteString] contains the following functions
>>> related to file times: accessTime, modificationTime, statusChangeTime,
>>> setFileTimes.
>>> All of these functions offer granularity of one second. Modern posix
>>> systems support newer functions (such as utimes, utimensat) that offer
>>> better granularity (up to 1 nanosecond).
>> Be aware that how these are provided varies:  Solaris, FreeBSD, and Linux
>> use different extensions and different types to represent them.
> Yes, I am well aware of that. What I meant is to pick the best
> function available using #ifdef's  and then convert the timestamps to
> a common type (such as POSIXTime from Data.Time.Clock.POSIX)
> irrespective of what function was actually used.

I posted a patch to the bug tracker [1]. It tries to detect the best
function available and uses that. It should work under all posix
systems. I tested it under Linux (x86 & x86-64), FreeBSD (x86) and Mac
OS X (x86-64).


More information about the Libraries mailing list