digitalmars.D.learn - =?ISO-8859-7?Q?how_to_round_durations_to_most_significant_unit_=3F_=285?=
- Timothee Cour (13/13) Feb 13 2014 Is there a function to do this?
Is there a function to do this? If not and I/someone writes it, is there interest to add it to std.datetime= ? Duration t =3D ...; t.to!string =3D> 5 secs, 889 ms, and 811 =ECs t.round.to!string =3D> 5 secs t=3D...; t.to!string =3D> 889 ms, and 811 =ECs t.round.to!string =3D> 889 secs Use case: shorter logs. Similarly, it would be nice to have a module in phobos for representing other units such as bytes, and have a similar rounding scheme as in unix command 'ls -lh' which shows 532K, 12M etc)
Feb 13 2014