[Haskell-cafe] Catching up on Time and Directory
gale at sefer.org
Tue Nov 16 07:50:57 EST 2010
Jon Fairbairn wrote:
> I'm probably terribly out of date with this, so I wonder if
> anyone can save me the bother of working out what the
> /preferred/ libraries are for (a) determining the
> last-modified-time of a file or directory and (b) manipulating
> the resulting time datum.
> I can find System.Directory.getModificationTime and
> Data.Time.formatTime, but using them together seems unduly
It's not you who is out of date - it is the base library, which
*still* uses the long deprecated old-time library for these
kinds of functions.
Is there an existing trac ticket about this?
Going via a string representation is obviously not
the most robust or efficient method, but converting to a
CalendarTime and manually building a UTCTime
from it may not be worth the effort.
One alternative is to use the convertible package.
Then you can just say:
utc <- fmap convert (getModificationTime myFile) :: IO UTCTime
More information about the Haskell-Cafe