]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_quota: only round up timer reporting > 1 day
authorEric Sandeen <sandeen@redhat.com>
Fri, 3 Jun 2016 01:04:15 +0000 (11:04 +1000)
committerDave Chinner <david@fromorbit.com>
Fri, 3 Jun 2016 01:04:15 +0000 (11:04 +1000)
commitf61be1b4401e7653b2bdcd3aac2130a4da10faa5
treeed2f222b766daf38c08d3fdd9f60fb56a35cb438
parentef12e07674ce8e8549a10bbdcb8b3377d430fa0a
xfs_quota: only round up timer reporting > 1 day

I was too hasty with:

d1fe6ff xfs_quota: remove extra 30 seconds from time limit reporting

The point of that extra 30s, turns out, was to allow the user
to set a limit, query it, and get back what they just set, if
it is set to more than a day.

Without it, if we set a grace period to i.e. 3 days, and query it
1 second later, the rounding in the time_to_string function returns
"2 days" not "3 days" as it did before, because we are at
2 days 23:59:59 and it essentially applies a floor() for
brevity.  I guess this was confusing.

(I've run into this same conundrum on my stove digital timer;
if you set it to 10m, it blinks "10" at you twice so that you
know what you set, then quickly flips to 9 as it counts down).

In some cases, however (and this is the case that prompted the
prior patch), we display a full "XYZ days hh:mm:ss" - we do this
if the verbose flag is set, or if the timer is less than one day.
In these cases, we should not add the 30s, because we are showing
full time resolution to the user.

Reported-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
quota/util.c