[commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Handle 'c' also in formatTime for ZonedTime, to get %Z filled in for ZonedTime and UTCTime. (573daed)
git at git.haskell.org
git at git.haskell.org
Mon Feb 20 21:11:20 UTC 2017
- Previous message: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added missing example for showWeekDate. (147381b)
- Next message: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Add secondsToDiffTime and picosecondsToDiffTime. (96ec994)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Repository : ssh://git@git.haskell.org/time
On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis
Link : http://git.haskell.org/packages/time.git/commitdiff/573daed43a143ea75360c23317ec9efebe01dfe5
>---------------------------------------------------------------
commit 573daed43a143ea75360c23317ec9efebe01dfe5
Author: bjorn <bjorn at bringert.net>
Date: Wed Nov 15 14:08:18 2006 -0800
Handle 'c' also in formatTime for ZonedTime, to get %Z filled in for ZonedTime and UTCTime.
Before, formatTime "%c" did not include the time zone even when applied to ZonedTime or UTCTime,
since "%c" was handled by the FormatTime LocalTime instance:
> fmap (formatTime System.Locale.defaultTimeLocale "%c") getZonedTime
"Sat Nov 11 19:12:45.395568 2006"
> fmap (formatTime System.Locale.defaultTimeLocale "%c") getCurrentTime
"Sat Nov 11 18:13:52.010944 2006"
Now it is correct:
> fmap (formatTime System.Locale.defaultTimeLocale "%c") getZonedTime
"Wed Nov 15 23:08:43.987526 CET 2006"
> fmap (formatTime System.Locale.defaultTimeLocale "%c") getCurrentTime
"Wed Nov 15 22:08:51.530603 UTC 2006"
darcs-hash:20061115220818-6cdb2-db20654b473141486d86a09551688043eebafb8b
>---------------------------------------------------------------
573daed43a143ea75360c23317ec9efebe01dfe5
Data/Time/LocalTime/Format.hs | 1 +
1 file changed, 1 insertion(+)
diff --git a/Data/Time/LocalTime/Format.hs b/Data/Time/LocalTime/Format.hs
index d817c13..c13160e 100644
--- a/Data/Time/LocalTime/Format.hs
+++ b/Data/Time/LocalTime/Format.hs
@@ -160,6 +160,7 @@ instance FormatTime TimeOfDay where
formatCharacter _ = Nothing
instance FormatTime ZonedTime where
+ formatCharacter 'c' = Just (\locale -> formatTime locale (dateTimeFmt locale))
formatCharacter 's' = Just (\_ zt -> show (truncate (utcTimeToPOSIXSeconds (zonedTimeToUTC zt)) :: Integer))
formatCharacter c = case (formatCharacter c) of
Just f -> Just (\locale dt -> f locale (zonedTimeToLocalTime dt))
- Previous message: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added missing example for showWeekDate. (147381b)
- Next message: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Add secondsToDiffTime and picosecondsToDiffTime. (96ec994)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the ghc-commits
mailing list