From 461c490afd909e452ad8f641b1bc651cab438016 Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Thu, 27 Sep 2007 19:35:57 +0200 Subject: Date: updated to recent API changes darcs-hash:20070927173557-d6583-73e62f127050653aa83aa08d49af6de137bf26a6.gz --- Plugins/Date.hs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'Plugins') diff --git a/Plugins/Date.hs b/Plugins/Date.hs index 0e47c6f..7b97916 100644 --- a/Plugins/Date.hs +++ b/Plugins/Date.hs @@ -18,20 +18,22 @@ module Plugins.Date where import Plugins + import System.Locale import System.Time - data Date = Date String String Int - deriving (Read) + deriving (Read, Show) instance Exec Date where - run (Date f _ _) = date f - rate (Date _ _ r) = r - alias (Date _ a _) = a - -date :: String -> IO String -date format = do - t <- toCalendarTime =<< getClockTime - return $ formatCalendarTime defaultTimeLocale format t + start (Date f _ r) cb = date f r cb + rate (Date _ _ r) = r + alias (Date _ a _) = a +date :: String -> Int -> (String -> IO ()) -> IO () +date format r cb = do go + where go = do + t <- toCalendarTime =<< getClockTime + cb $ formatCalendarTime defaultTimeLocale format t + tenthSeconds r >> go + \ No newline at end of file -- cgit v1.2.3