summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@ing.unitn.it>2007-09-27 19:35:57 +0200
committerAndrea Rossato <andrea.rossato@ing.unitn.it>2007-09-27 19:35:57 +0200
commit461c490afd909e452ad8f641b1bc651cab438016 (patch)
treedbd6fbde3504fbbfca71953c35b8f6b5e9282570
parent48e62d3cffe28d46016f827066e98f1b1c47b358 (diff)
downloadxmobar-461c490afd909e452ad8f641b1bc651cab438016.tar.gz
xmobar-461c490afd909e452ad8f641b1bc651cab438016.tar.bz2
Date: updated to recent API changes
darcs-hash:20070927173557-d6583-73e62f127050653aa83aa08d49af6de137bf26a6.gz
-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