module Text.Show.Text.System.Time (
showbClockTime
, showbTimeDiffPrec
, showbCalendarTimePrec
, showbMonth
, showbDay
) where
import Prelude hiding (Show)
import System.IO.Unsafe (unsafePerformIO)
import System.Time (ClockTime, TimeDiff, CalendarTime, Month, Day,
calendarTimeToString, toCalendarTime)
import Text.Show.Text (Show(showb, showbPrec), Builder, fromString)
import Text.Show.Text.TH (deriveShow)
#include "inline.h"
showbClockTime :: ClockTime -> Builder
showbClockTime = fromString . calendarTimeToString . unsafePerformIO . toCalendarTime
showbTimeDiffPrec :: Int -> TimeDiff -> Builder
showbTimeDiffPrec = showbPrec
showbCalendarTimePrec :: Int -> CalendarTime -> Builder
showbCalendarTimePrec = showbPrec
showbMonth :: Month -> Builder
showbMonth = showb
showbDay :: Day -> Builder
showbDay = showb
instance Show ClockTime where
showb = showbClockTime
INLINE_INST_FUN(showb)
$(deriveShow ''TimeDiff)
$(deriveShow ''CalendarTime)
$(deriveShow ''Month)
$(deriveShow ''Day)