chronos 1.0.4 → 1.0.5
raw patch · 3 files changed
+39/−8 lines, 3 filesdep ~clockdep ~hashabledep ~primitivenew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: clock, hashable, primitive, semigroups, text
API changes (from Hackage documentation)
- Chronos: DatetimeFormat :: !(Maybe Char) -> !(Maybe Char) -> !(Maybe Char) -> DatetimeFormat
+ Chronos: DatetimeFormat :: !Maybe Char -> !Maybe Char -> !Maybe Char -> DatetimeFormat
- Chronos: DatetimeLocale :: !(DayOfWeekMatch a) -> !(DayOfWeekMatch a) -> !(MonthMatch a) -> !(MonthMatch a) -> DatetimeLocale a
+ Chronos: DatetimeLocale :: !DayOfWeekMatch a -> !DayOfWeekMatch a -> !MonthMatch a -> !MonthMatch a -> DatetimeLocale a
- Chronos: [datetimeFormatDateSeparator] :: DatetimeFormat -> !(Maybe Char)
+ Chronos: [datetimeFormatDateSeparator] :: DatetimeFormat -> !Maybe Char
- Chronos: [datetimeFormatSeparator] :: DatetimeFormat -> !(Maybe Char)
+ Chronos: [datetimeFormatSeparator] :: DatetimeFormat -> !Maybe Char
- Chronos: [datetimeFormatTimeSeparator] :: DatetimeFormat -> !(Maybe Char)
+ Chronos: [datetimeFormatTimeSeparator] :: DatetimeFormat -> !Maybe Char
- Chronos: [datetimeLocaleDaysOfWeekAbbreviated] :: DatetimeLocale a -> !(DayOfWeekMatch a)
+ Chronos: [datetimeLocaleDaysOfWeekAbbreviated] :: DatetimeLocale a -> !DayOfWeekMatch a
- Chronos: [datetimeLocaleDaysOfWeekFull] :: DatetimeLocale a -> !(DayOfWeekMatch a)
+ Chronos: [datetimeLocaleDaysOfWeekFull] :: DatetimeLocale a -> !DayOfWeekMatch a
- Chronos: [datetimeLocaleMonthsAbbreviated] :: DatetimeLocale a -> !(MonthMatch a)
+ Chronos: [datetimeLocaleMonthsAbbreviated] :: DatetimeLocale a -> !MonthMatch a
- Chronos: [datetimeLocaleMonthsFull] :: DatetimeLocale a -> !(MonthMatch a)
+ Chronos: [datetimeLocaleMonthsFull] :: DatetimeLocale a -> !MonthMatch a
- Chronos.Types: DatetimeFormat :: !(Maybe Char) -> !(Maybe Char) -> !(Maybe Char) -> DatetimeFormat
+ Chronos.Types: DatetimeFormat :: !Maybe Char -> !Maybe Char -> !Maybe Char -> DatetimeFormat
- Chronos.Types: DatetimeLocale :: !(DayOfWeekMatch a) -> !(DayOfWeekMatch a) -> !(MonthMatch a) -> !(MonthMatch a) -> DatetimeLocale a
+ Chronos.Types: DatetimeLocale :: !DayOfWeekMatch a -> !DayOfWeekMatch a -> !MonthMatch a -> !MonthMatch a -> DatetimeLocale a
- Chronos.Types: [datetimeFormatDateSeparator] :: DatetimeFormat -> !(Maybe Char)
+ Chronos.Types: [datetimeFormatDateSeparator] :: DatetimeFormat -> !Maybe Char
- Chronos.Types: [datetimeFormatSeparator] :: DatetimeFormat -> !(Maybe Char)
+ Chronos.Types: [datetimeFormatSeparator] :: DatetimeFormat -> !Maybe Char
- Chronos.Types: [datetimeFormatTimeSeparator] :: DatetimeFormat -> !(Maybe Char)
+ Chronos.Types: [datetimeFormatTimeSeparator] :: DatetimeFormat -> !Maybe Char
- Chronos.Types: [datetimeLocaleDaysOfWeekAbbreviated] :: DatetimeLocale a -> !(DayOfWeekMatch a)
+ Chronos.Types: [datetimeLocaleDaysOfWeekAbbreviated] :: DatetimeLocale a -> !DayOfWeekMatch a
- Chronos.Types: [datetimeLocaleDaysOfWeekFull] :: DatetimeLocale a -> !(DayOfWeekMatch a)
+ Chronos.Types: [datetimeLocaleDaysOfWeekFull] :: DatetimeLocale a -> !DayOfWeekMatch a
- Chronos.Types: [datetimeLocaleMonthsAbbreviated] :: DatetimeLocale a -> !(MonthMatch a)
+ Chronos.Types: [datetimeLocaleMonthsAbbreviated] :: DatetimeLocale a -> !MonthMatch a
- Chronos.Types: [datetimeLocaleMonthsFull] :: DatetimeLocale a -> !(MonthMatch a)
+ Chronos.Types: [datetimeLocaleMonthsFull] :: DatetimeLocale a -> !MonthMatch a
Files
- bench/Bench.hs +30/−0
- chronos.cabal +5/−3
- src/Chronos/Internal/CTimespec.hs +4/−5
bench/Bench.hs view
@@ -20,6 +20,7 @@ import Data.Word import Control.Monad (when) import Control.Applicative+import Data.Text.Lazy.Builder (toLazyText) import qualified Data.Time as Time import qualified Data.Thyme as Thyme@@ -54,7 +55,23 @@ either error id . Z.parse (Chronos.zeptoUtf8_YmdHMS Chronos.w3c) + dmy = "%d:%m:%y."+ hms = "%%H:%M:%S."+ timePretty = Time.formatTime Time.defaultTimeLocale+ thymePretty = Thyme.formatTime Thyme.defaultTimeLocale+ chronosPrettyDmy = toLazyText+ . Chronos.builder_Dmy (Just ':')+ . Chronos.datetimeDate+ . Chronos.timeToDatetime+ chronosPrettyHMS = toLazyText+ . Chronos.builder_HMS Chronos.SubsecondPrecisionAuto (Just ':')+ . Chronos.datetimeTime+ . Chronos.timeToDatetime + timeTime <- Time.getCurrentTime+ thymeTime <- Thyme.getCurrentTime+ chronosTime <- Chronos.now+ string <- return $!! renderIsoTime utcthyme bytestring <- return $!! BS8.pack (renderIsoTime utcthyme) @@ -65,6 +82,19 @@ , bench "Thyme.timeParser" $ nf thymeAttoparsec bytestring , bench "Chronos.parserUtf8_YmdHMS" $ nf chronosAttoparsec bytestring , bench "Chronos.zeptoUtf8_YmdHMS" $ nf chronosZepto bytestring+ ]++ , bgroup "prettyPrint"+ [ bgroup "dmy"+ [ bench "Time.formatTime" $ nf (timePretty dmy) timeTime+ , bench "Thyme.formatTime" $ nf (thymePretty dmy) thymeTime+ , bench "Chronos.builder_Dmy" $ nf chronosPrettyDmy chronosTime+ ]+ , bgroup "HMS"+ [ bench "Time.formatTime" $ nf (timePretty hms) timeTime+ , bench "Thyme.formatTime" $ nf (thymePretty hms) thymeTime+ , bench "Chronos.builder_HMS" $ nf chronosPrettyHMS chronosTime+ ] ] ]
chronos.cabal view
@@ -1,5 +1,5 @@ name: chronos-version: 1.0.4+version: 1.0.5 synopsis: A performant time library description: Performance-oriented time library for haskell. The main differences@@ -44,10 +44,10 @@ Chronos.Internal.CTimespec build-depends: base >= 4.9 && < 5- , aeson >= 1.1 && < 1.4+ , aeson >= 1.1 && < 1.5 , attoparsec >= 0.13 && < 0.14 , bytestring >= 0.10 && < 0.11- , clock >= 0.7 && < 0.8+ , clock >= 0.7 && < 0.9 , hashable >= 1.2 && < 1.3 , primitive >= 0.6 && < 0.7 , semigroups >= 0.16 && < 0.19@@ -56,6 +56,7 @@ , vector >= 0.11 && < 0.13 default-language: Haskell2010 c-sources: src/cbits/hs-time.c+ ghc-options: -Wall -O2 test-suite chronos-test type: exitcode-stdio-1.0@@ -91,6 +92,7 @@ , thyme , time , vector+ , text default-language: Haskell2010 source-repository head
src/Chronos/Internal/CTimespec.hs view
@@ -9,12 +9,11 @@ import Foreign.C #ifdef ghcjs_HOST_OS---- foreign import javascript unsafe "Date.now()" currentSeconds :: IO Int64-+foreign import javascript unsafe "Date.now()" currentSeconds :: IO Double getPosixNanoseconds :: IO Int64-getPosixNanoseconds = return 0-+getPosixNanoseconds = do + x <- currentSeconds + pure $ fromIntegral $ 1000000 * (round x) #else data CTimespec = CTimespec