summaryrefslogtreecommitdiffhomepage
path: root/Plugins/Date.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Plugins/Date.hs')
-rw-r--r--Plugins/Date.hs22
1 files changed, 12 insertions, 10 deletions
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