Skip to content

Commit

Permalink
Raise Size exception from Time.fmt
Browse files Browse the repository at this point in the history
This applies changes suggested by @JohnReppy to fix issue kfl#36
  • Loading branch information
mrhmouse committed Apr 25, 2016
1 parent 96407bc commit 9d295e6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mosmllib/Time.sml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ in

fun timeToUnits (t, p) = floor(toReal t * negpow10 p + 0.5);

fun fmt p r =
Real.fmt (StringCvt.FIX (SOME (if p > 0 then p else 0))) (r/1000000.0);
fun fmt p = if (p < 0)
then raise Size
else (fn r => Real.fmt (StringCvt.FIX (SOME p)) (r/1000000.0));

fun toString t = fmt 3 t;

Expand Down

0 comments on commit 9d295e6

Please sign in to comment.