From fe59ea1a62ff8dd15e30646802b9ca045df3008b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 2 Sep 2015 15:23:47 -0700 Subject: propellor spin --- src/Propellor/Property/Parted.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Propellor/Property/Parted.hs') diff --git a/src/Propellor/Property/Parted.hs b/src/Propellor/Property/Parted.hs index 1ff8677a..0b77fad1 100644 --- a/src/Propellor/Property/Parted.hs +++ b/src/Propellor/Property/Parted.hs @@ -95,8 +95,9 @@ newtype PartSize = MegaBytes Integer instance PartedVal PartSize where val (MegaBytes n) = show n ++ "MB" +-- | Rounds up to the nearest MegaByte. toPartSize :: ByteSize -> PartSize -toPartSize b = MegaBytes (b `div` 1000000) +toPartSize b = MegaBytes $ ceiling (fromInteger b / 1000000 :: Double) fromPartSize :: PartSize -> ByteSize fromPartSize (MegaBytes b) = b * 1000000 -- cgit v1.2.3