Get creation date from a file function missing?

The procedure file-or-directory-modify-seconds exists, yet I can't seem to find a similar function for the creation date.

1 Like

Snapshot releases have a function file-or-directory-stat, where the result hash contains the fields 'creation-time-seconds and 'creation-time-nanoseconds.

However, there are a few caveats:

  • On both Posix and Windows, the underlying C stat call returns a struct with a "ctime" field. On Windows, this is the creation time, but on Posix, this is the status change time. So the creation timestamp is only available on Windows.
  • In favor of a simpler implementation, there's (at least currently) no result more accurate than seconds, i.e. the 'creation-time-nanoseconds hash value is the same hash value as for 'creation-time-seconds, but multiplied by 1e9.

What do you need the creation time for?

4 Likes

Seems like this should be more explicitly documented!

3 Likes

I think you're right. I thought I had documented this, but looking at the snapshot documentation, apparently I didn't. I'll make a PR (if I don't forget it :wink: ).

Edit: Done, but I described the matter only from the perspective of a Racket user, without going into the details of the underlying stat calls on Posix and Windows.

4 Likes