summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Logs/TimeStamp.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/Logs/TimeStamp.hs b/Logs/TimeStamp.hs
new file mode 100644
index 000000000..2832a3d65
--- /dev/null
+++ b/Logs/TimeStamp.hs
@@ -0,0 +1,21 @@
+{- log timestamp parsing
+ -
+ - Copyright 2015 Joey Hess <id@joeyh.name>
+ -
+ - Licensed under the GNU GPL version 3 or higher.
+ -}
+
+{-# LANGUAGE CPP #-}
+
+module Logs.TimeStamp where
+
+import Data.Time.Clock.POSIX
+import Data.Time
+#if ! MIN_VERSION_time(1,5,0)
+import System.Locale
+#endif
+
+import Common
+
+parsePOSIXTime :: String -> Maybe POSIXTime
+parsePOSIXTime s = utcTimeToPOSIXSeconds <$> parseTime defaultTimeLocale "%s%Qs" s