make Arbitrary POSIXTime include decimal half the time

This commit is contained in:
Joey Hess 2018-10-31 16:27:55 -04:00
parent 2ca408dc33
commit 5ad5d45d4c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 11 additions and 13 deletions

View file

@ -269,16 +269,8 @@ instance Arbitrary MTime where
arbitrary = frequency
-- timestamp is not usually negative
[ (50, MTimeLowRes <$> (abs . fromInteger <$> arbitrary))
, (50, MTimeHighRes <$> (abs <$> arbposixtime))
, (50, MTimeHighRes <$> arbitrary)
]
where
-- include fractional part, which the usual instance does not
arbposixtime = do
t <- arbitrary
f <- arbitrary
return $ if f == 0
then t
else t + recip f
#ifdef mingw32_HOST_OS
instance Arbitrary FileID where