diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,8 @@
 # Change Log
 
+## [1.8.0.2]
+- Fix behaviour of %Q in format
+
 ## [1.8.0.1]
 - Get building on 32 bit machine
 
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([Haskell time package], [1.8.0.1], [ashley@semantic.org], [time])
+AC_INIT([Haskell time package], [1.8.0.2], [ashley@semantic.org], [time])
 
 # Safety check: Ensure that we are in the correct source directory.
 AC_CONFIG_SRCDIR([lib/include/HsTime.h])
diff --git a/lib/Data/Time/Clock/Internal/SystemTime.hs b/lib/Data/Time/Clock/Internal/SystemTime.hs
--- a/lib/Data/Time/Clock/Internal/SystemTime.hs
+++ b/lib/Data/Time/Clock/Internal/SystemTime.hs
@@ -19,7 +19,7 @@
 
 #ifdef mingw32_HOST_OS
 import qualified System.Win32.Time as Win32
-#elif HAVE_CLOCK_GETTIME
+#elif defined(HAVE_CLOCK_GETTIME)
 import Data.Time.Clock.Internal.CTimespec
 import Foreign.C.Types (CTime(..), CLong(..))
 #else
@@ -67,7 +67,7 @@
 getTime_resolution = 100E-9 -- 100ns
 getTAISystemTime = Nothing
 
-#elif HAVE_CLOCK_GETTIME
+#elif defined(HAVE_CLOCK_GETTIME)
 -- Use hi-res clock_gettime
 
 timespecToSystemTime :: CTimespec -> SystemTime
diff --git a/lib/Data/Time/Format.hs b/lib/Data/Time/Format.hs
--- a/lib/Data/Time/Format.hs
+++ b/lib/Data/Time/Format.hs
@@ -143,7 +143,7 @@
 -- [@%q@] picosecond of second, 0-padded to twelve chars, @000000000000@ - @999999999999@.
 --
 -- [@%Q@] decimal point and fraction of second, up to 12 second decimals, without trailing zeros.
--- For a whole number of seconds, @%Q@ produces the empty string.
+-- For a whole number of seconds, @%Q@ omits the decimal point unless padding is specified.
 --
 -- === 'UTCTime' and 'ZonedTime'
 -- For 'UTCTime' and 'ZonedTime':
@@ -275,7 +275,9 @@
     -- Second
     formatCharacter 'S' = Just $ padNum True  2 '0' $ (floor . todSec :: TimeOfDay -> Int)
     formatCharacter 'q' = Just $ padGeneral True True 12 '0' $ \_ pado -> showPaddedFixedFraction pado . todSec
-    formatCharacter 'Q' = Just $ padGeneral True False 12 '0' $ \_ pado -> ('.':) . showPaddedFixedFraction pado . todSec
+    formatCharacter 'Q' = Just $ padGeneral True False 12 '0' $ \_ pado -> dotNonEmpty . showPaddedFixedFraction pado . todSec where
+        dotNonEmpty "" = ""
+        dotNonEmpty s = '.':s
 
     -- Default
     formatCharacter _   = Nothing
diff --git a/test/unix/Test/Format/Format.hs b/test/unix/Test/Format/Format.hs
--- a/test/unix/Test/Format/Format.hs
+++ b/test/unix/Test/Format/Format.hs
@@ -190,13 +190,13 @@
     formatUnitTest "%-5q" 0 "     ",
     formatUnitTest "%-5q" 0.37 "37   ",
 
-    formatUnitTest "%Q" 0 ".",
+    formatUnitTest "%Q" 0 "",
     formatUnitTest "%Q" 0.37 ".37",
     formatUnitTest "%0Q" 0 ".000000000000",
     formatUnitTest "%0Q" 0.37 ".370000000000",
     formatUnitTest "%_Q" 0 ".            ",
     formatUnitTest "%_Q" 0.37 ".37          ",
-    formatUnitTest "%-Q" 0 ".",
+    formatUnitTest "%-Q" 0 "",
     formatUnitTest "%-Q" 0.37 ".37",
     formatUnitTest "%1Q" 0 ".0",
     formatUnitTest "%1Q" 0.37 ".3",
diff --git a/time.cabal b/time.cabal
--- a/time.cabal
+++ b/time.cabal
@@ -1,5 +1,5 @@
 name:           time
-version:        1.8.0.1
+version:        1.8.0.2
 stability:      stable
 license:        BSD3
 license-file:   LICENSE
