diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-09-02 15:23:47 -0700 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-09-02 15:23:47 -0700 |
| commit | fe59ea1a62ff8dd15e30646802b9ca045df3008b (patch) | |
| tree | fcceba43ff80d83fdd50d1aeb8407db47aa92145 /src/Propellor/Property/Parted.hs | |
| parent | 418e6a5b4ee36360911cdff14f70357c5c2bfc80 (diff) | |
propellor spin
Diffstat (limited to 'src/Propellor/Property/Parted.hs')
| -rw-r--r-- | src/Propellor/Property/Parted.hs | 3 |
1 files changed, 2 insertions, 1 deletions
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 |
