diff --git a/doc/manual.md b/doc/manual.md index 7225b8b52..390a240c5 100644 --- a/doc/manual.md +++ b/doc/manual.md @@ -736,10 +736,10 @@ and creates a virtual transaction (or several - one per day) with the appropriate amount of hours. From the time log above, hledger print gives: 2009/03/31 * 22:21-23:59 - (projects:A) 1.6h + (projects:A) 1.64h 2009/04/01 * 00:00-02:00 - (projects:A) 2.0h + (projects:A) 2.01h Here is a [sample.timelog](https://raw.github.com/simonmichael/hledger/master/data/sample.timelog) to diff --git a/hledger-lib/Hledger/Data/Amount.hs b/hledger-lib/Hledger/Data/Amount.hs index 6974e38ac..3ff317c26 100644 --- a/hledger-lib/Hledger/Data/Amount.hs +++ b/hledger-lib/Hledger/Data/Amount.hs @@ -155,10 +155,10 @@ missingamt = amount{acommodity="AUTO"} -- Handy amount constructors for tests. -- usd/eur/gbp round their argument to a whole number of pennies/cents. num n = amount{acommodity="", aquantity=n} +hrs n = amount{acommodity="h", aquantity=n, astyle=amountstyle{asprecision=2, ascommodityside=R}} usd n = amount{acommodity="$", aquantity=roundTo 2 n, astyle=amountstyle{asprecision=2}} eur n = amount{acommodity="€", aquantity=roundTo 2 n, astyle=amountstyle{asprecision=2}} gbp n = amount{acommodity="£", aquantity=roundTo 2 n, astyle=amountstyle{asprecision=2}} -hrs n = amount{acommodity="h", aquantity=roundTo 1 n, astyle=amountstyle{asprecision=1, ascommodityside=R}} amt `at` priceamt = amt{aprice=UnitPrice priceamt} amt @@ priceamt = amt{aprice=TotalPrice priceamt} diff --git a/hledger-lib/Hledger/Data/Transaction.hs b/hledger-lib/Hledger/Data/Transaction.hs index 599df603f..a97d3c039 100644 --- a/hledger-lib/Hledger/Data/Transaction.hs +++ b/hledger-lib/Hledger/Data/Transaction.hs @@ -122,7 +122,7 @@ tests_showTransactionUnelided = [ "2012/05/14=2012/05/15 (code) desc ; tcomment1", " ; tcomment2", " $1.00", - " * a 2.0h", + " * a 2.00h", " ; pcomment2", "" ] @@ -203,7 +203,7 @@ tests_postingAsLines = [ } `gives` [ " $1.00", - " * a 2.0h ; pcomment1", + " * a 2.00h ; pcomment1", " ; pcomment2", " ; tag3: val3 " ] diff --git a/hledger/Hledger/Cli.hs b/hledger/Hledger/Cli.hs index 6d0c1ef65..71c7ea71b 100644 --- a/hledger/Hledger/Cli.hs +++ b/hledger/Hledger/Cli.hs @@ -132,7 +132,7 @@ tests_Hledger_Cli = TestList ,"show dollars" ~: showAmount (usd 1) ~?= "$1.00" - ,"show hours" ~: showAmount (hrs 1) ~?= "1.0h" + ,"show hours" ~: showAmount (hrs 1) ~?= "1.00h" ] diff --git a/tests/timelog/timelog.test b/tests/timelog/timelog.test index a366d1f0f..9e9b35194 100644 --- a/tests/timelog/timelog.test +++ b/tests/timelog/timelog.test @@ -6,7 +6,7 @@ o 2009/1/1 09:00:00 >>> 2009/01/01 * 08:00-09:00 - (something) 1.0h + (something) 1.00h >>>2 >>>= 0