module TextShow.System.Time (
showbClockTime
, showbTimeDiffPrec
, showbCalendarTimePrec
, showbMonth
, showbDay
) where
import System.IO.Unsafe (unsafePerformIO)
import System.Time (ClockTime, TimeDiff, CalendarTime, Month, Day,
calendarTimeToString, toCalendarTime)
import TextShow (TextShow(..), Builder, fromString)
import TextShow.TH (deriveTextShow)
#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 TextShow ClockTime where
showb = showbClockTime
INLINE_INST_FUN(showb)
$(deriveTextShow ''TimeDiff)
$(deriveTextShow ''CalendarTime)
$(deriveTextShow ''Month)
$(deriveTextShow ''Day)