File: UTCDiff.hs

package info (click to toggle)
haskell-time 1.0-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 304 kB
  • ctags: 5
  • sloc: haskell: 796; makefile: 60; ansic: 49; sh: 22
file content (15 lines) | stat: -rw-r--r-- 441 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{-# OPTIONS -Wall -Werror #-}

-- #hide
module Data.Time.Clock.UTCDiff where

import Data.Time.Clock.POSIX
import Data.Time.Clock.UTC

-- | addUTCTime a b = a + b
addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime
addUTCTime x t = posixSecondsToUTCTime (x + (utcTimeToPOSIXSeconds t))

-- | diffUTCTime a b = a - b
diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime
diffUTCTime a b = (utcTimeToPOSIXSeconds a) - (utcTimeToPOSIXSeconds b)