diff --git a/arbtt.cabal b/arbtt.cabal
--- a/arbtt.cabal
+++ b/arbtt.cabal
@@ -1,5 +1,5 @@
 name:               arbtt
-version:            0.9.0.1
+version:            0.9.0.2
 license:            GPL
 license-file:       LICENSE
 category:           Desktop
@@ -23,23 +23,35 @@
     data.
 homepage:           http://arbtt.nomeata.de/
 bug-reports:        https://bitbucket.org/nomeata/arbtt/issues
-
 extra-source-files:
     categorize.cfg, arbtt-capture.desktop, README.md,
     doc/arbtt.xml, doc/fptools.css, doc/Makefile,
     setup.iss, modpath.iss,
     tests/*.log, tests/*.out, tests/*.in, tests/*.cfg
 
+flag old-locale
+  description:
+    If false then depend on time >= 1.5.
+    .
+    If true then depend on time < 1.5 together with old-locale.
+  default: False
+
 executable arbtt-capture
     main-is:            capture-main.hs
     hs-source-dirs:     src
     build-depends:
         base == 4.5.* || == 4.6.* || == 4.7.* || == 4.8.*,
-        filepath, directory, transformers, time >= 1.4, utf8-string,
+        filepath, directory, transformers, utf8-string,
         aeson == 0.6.* || == 0.7.* || == 0.8.*,
         array == 0.4.* || == 0.5.*,
         binary >= 0.5,
-        bytestring, deepseq, strict, old-locale
+        bytestring, deepseq, strict
+
+    if flag(old-locale)
+        build-depends: time == 1.4.*, old-locale
+    else
+        build-depends: time >= 1.5, old-locale
+
     other-modules:
         Data
         Data.MyText
@@ -79,13 +91,20 @@
         base == 4.5.* || == 4.6.* || == 4.7.* || == 4.8.*,
         parsec == 3.*,
         containers == 0.5.*,
-        pcre-light, old-locale,
+        pcre-light,
         binary >= 0.5,
-        deepseq, bytestring, utf8-string, time >= 1.4, strict,
+        deepseq, bytestring, utf8-string, strict,
         transformers, unix, directory, filepath,
         aeson == 0.6.* || == 0.7.* || == 0.8.*,
         array == 0.4.* || == 0.5.*,
-        terminal-progress-bar, bytestring-progress
+        terminal-progress-bar,
+        bytestring-progress
+
+    if flag(old-locale)
+        build-depends: time == 1.4.*, old-locale
+    else
+        build-depends: time >= 1.5, old-locale
+
     other-modules:
         Data
         Data.MyText
@@ -116,9 +135,14 @@
         aeson == 0.6.* || == 0.7.* || == 0.8.*,
         array == 0.4.* || == 0.5.*,
         binary >= 0.5,
-        deepseq, bytestring, utf8-string, time >= 1.4, strict,
-        transformers, unix, directory, filepath,
-        old-locale
+        deepseq, bytestring, utf8-string, strict,
+        transformers, unix, directory, filepath
+
+    if flag(old-locale)
+        build-depends: time == 1.4.*, old-locale
+    else
+        build-depends: time >= 1.5, old-locale
+
     other-modules:
         Data
         Data.MyText
@@ -143,8 +167,14 @@
         parsec == 3.*,
         containers == 0.5.*,
         binary >= 0.5,
-        deepseq, bytestring, utf8-string, time >= 1.4, strict,
+        deepseq, bytestring, utf8-string, strict,
         transformers, unix, directory, filepath
+
+    if flag(old-locale)
+        build-depends: time == 1.4.*, old-locale
+    else
+        build-depends: time >= 1.5, old-locale
+
     other-modules:
         Data
         Data.MyText
@@ -166,8 +196,14 @@
         base == 4.5.* || == 4.6.* || == 4.7.* || == 4.8.*,
         parsec == 3.*, containers == 0.5.*,
         binary >= 0.5,
-        deepseq, bytestring, utf8-string, time >= 1.4, strict,
+        deepseq, bytestring, utf8-string, strict,
         transformers, unix, directory, filepath
+
+    if flag(old-locale)
+        build-depends: time == 1.4.*, old-locale
+    else
+        build-depends: time >= 1.5, old-locale
+
     other-modules:
         Data
         Data.MyText
@@ -201,13 +237,17 @@
       , binary >= 0.5
       , bytestring
       , utf8-string
-      , time
       , unix
       , directory
       , parsec == 3.*
       , containers == 0.5.*
-      , pcre-light, old-locale
+      , pcre-light
       , transformers
+
+  if flag(old-locale)
+        build-depends: time == 1.4.*, old-locale
+  else
+        build-depends: time >= 1.5, old-locale
   default-language: Haskell98
 
 source-repository head
diff --git a/src/Categorize.hs b/src/Categorize.hs
--- a/src/Categorize.hs
+++ b/src/Categorize.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE Rank2Types #-}
+{-# LANGUAGE Rank2Types, CPP #-}
 module Categorize where
 
 import Data
@@ -31,7 +31,11 @@
 import Data.Time.Calendar (toGregorian, fromGregorian)
 import Data.Time.Calendar.WeekDate (toWeekDate)
 import Data.Time.Format (formatTime)
+#if MIN_VERSION_time(1,5,0)
+import Data.Time.Format(defaultTimeLocale, iso8601DateFormat)
+#else
 import System.Locale (defaultTimeLocale, iso8601DateFormat)
+#endif
 import Debug.Trace
 import Control.Arrow (second)
 import Text.Printf
diff --git a/src/DumpFormat.hs b/src/DumpFormat.hs
--- a/src/DumpFormat.hs
+++ b/src/DumpFormat.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE OverloadedStrings, RecordWildCards, FlexibleInstances #-}
+{-# LANGUAGE OverloadedStrings, RecordWildCards, FlexibleInstances, CPP #-}
 module DumpFormat
     ( DumpFormat(..)
     , readDumpFormat
@@ -11,7 +11,11 @@
 import Data.Aeson
 import qualified Data.ByteString.Lazy as LBS
 import Data.Time
-import System.Locale
+#if MIN_VERSION_time(1,5,0)
+import Data.Time.Format(defaultTimeLocale)
+#else
+import System.Locale (defaultTimeLocale)
+#endif
 import Data.Char
 
 import Data
diff --git a/src/Stats.hs b/src/Stats.hs
--- a/src/Stats.hs
+++ b/src/Stats.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE RecordWildCards, NamedFieldPuns, TypeOperators, TupleSections, GADTSyntax, ExistentialQuantification #-}
+{-# LANGUAGE RecordWildCards, NamedFieldPuns, TypeOperators, TupleSections, GADTSyntax, ExistentialQuantification, CPP #-}
 module Stats (
     Report(..),
     ReportOptions(..),
@@ -26,7 +26,11 @@
 import qualified Data.Set as S
 import Data.MyText (Text,pack,unpack)
 import Data.Function (on)
+#if MIN_VERSION_time(1,5,0)
+import Data.Time.Format(defaultTimeLocale)
+#else
 import System.Locale (defaultTimeLocale)
+#endif
 import Control.Applicative
 import Data.Strict ((:!:), Pair(..))
 import qualified Data.Strict as Strict
