[Haskell-cafe] Serializing UTCTimes

Bas van Dijk v.dijk.bas at gmail.com
Fri Jan 20 15:15:26 CET 2012


On 20 January 2012 15:03, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
> What's the recommended way for serializing (with the cereal package) an UTCTime?

I'm now using the datetime package so I can do:

import Data.DateTime (fromSeconds, toSeconds)

instance Serialize UTCTime where
    get = fromSeconds <$> get
    put = put . toSeconds

But I will have to look at the code of datetime to see if I'm not
loosing precision.

Bas



More information about the Haskell-Cafe mailing list