[Haskell-cafe] Serializing UTCTimes

Ertugrul Söylemez es at ertes.de
Fri Jan 20 15:26:23 CET 2012


Bas van Dijk <v.dijk.bas at gmail.com> wrote:

> However I have no idea how to serialize the DiffTime stored in an
> UTCTime:
>
> instance Serialize DiffTime where
>     get = ?
>     put = ?

Note that DiffTime has this weird property that there is a Real
instance, so you have a toRational function. ;)

To go the other way you have a Fractional instance, so you also have
'fromRational'.


Greets,
Ertugrul

-- 
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120120/c28fc71d/attachment.pgp>


More information about the Haskell-Cafe mailing list