• tnagel@chromium.org's avatar
    Fix rounding of time interval strings · 2dd24c86
    tnagel@chromium.org authored
    Previously, text output for time intervals always was rounded
    down. For example, a time interval of 1 min 59 sec was
    displayed as "1 min", which was confusing users in some cases.
    This CL implements rounding to nearest integer. Some example
    outputs are given below.
    
    0.49 sec --> "0 secs"
    0.5  sec --> "1 sec"
    59.4 sec --> "59 secs"
    59.5 sec --> "1 min"
    89.9 sec --> "1 min"
    90.0 sec --> "2 mins"
    59 min   --> "59 mins"
    60 min   --> "1 hour"
    89 min   --> "1 hour"
    90 min   --> "2 hours"
    ...
    
    BUG=338631
    TEST=unit tests updated
    
    Review URL: https://codereview.chromium.org/143633003
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247948 0039d316-1c4b-4281-b951-d872f2087c98
    2dd24c86
time_format.cc 13.2 KB