hscrtmpl 1.1 → 1.2
raw patch · 2 files changed
+10/−10 lines, 2 filesdep +timedep −old-time
Dependencies added: time
Dependencies removed: old-time
Files
- hscrtmpl.cabal +5/−5
- hscrtmpl.hs +5/−5
hscrtmpl.cabal view
@@ -1,10 +1,10 @@ name: hscrtmpl-version: 1.1+version: 1.2 cabal-version: >= 1.8 build-type: Simple license: BSD3 license-file: LICENSE-copyright: 2013 Dino Morelli+copyright: 2013-2014 Dino Morelli author: Dino Morelli maintainer: Dino Morelli <dino@ui3.info> stability: experimental@@ -12,7 +12,7 @@ synopsis: Haskell shell script template description: A template for writing shell scripts in Haskell. Contains some useful functions and examples of things commonly done in bash. category: Application, Console, Scripting-tested-with: GHC >= 7.6.2+tested-with: GHC >= 7.6.3 source-repository head type: darcs@@ -25,5 +25,5 @@ build-depends: base >= 3 && < 5, directory, old-locale,- old-time,- process+ process,+ time
hscrtmpl.hs view
@@ -21,17 +21,17 @@ Dino Morelli <dino@ui3.info> http://ui3.info/d/proj/hscrtmpl.html- version: 1.1+ version: 1.2 -} --import Control.Monad ( when, unless )+import Data.Time import System.Cmd import System.Directory --import System.Environment import System.Exit import System.Locale --import System.Process-import System.Time import Text.Printf --import Text.Regex @@ -60,15 +60,15 @@ For format string help, see man 3 strftime -} dateFormat :: String -> IO String-dateFormat fmt = fmap (formatCalendarTime defaultTimeLocale- fmt) (getClockTime >>= toCalendarTime)+dateFormat fmt = formatTime defaultTimeLocale fmt `fmap`+ (getCurrentTime >>= utcToLocalZonedTime) {- Output a message with datestamp -} logM :: String -> IO () logM msg = do- tstamp <- dateFormat "%Y-%m-%d %H:%M:%S"+ tstamp <- dateFormat "%F %T" printf "%s> %s\n" tstamp msg