don't add 30 seconds when formatting time, as float->int conversion

2009-02-22  Cosimo Cecchi  <cosimoc@gnome.org>

	* libnautilus-private/nautilus-file-operations.c
	(seconds_count_format_time_units), (format_time):
	don't add 30 seconds when formatting time, as float->int conversion
	already truncates the value for us (#572284).

svn path=/trunk/; revision=14991
This commit is contained in:
Cosimo Cecchi 2009-02-22 22:10:22 +00:00 committed by Cosimo Cecchi
parent 4e4cbea644
commit ee0b2f7910
2 changed files with 11 additions and 4 deletions

View file

@ -1,3 +1,10 @@
2009-02-22 Cosimo Cecchi <cosimoc@gnome.org>
* libnautilus-private/nautilus-file-operations.c
(seconds_count_format_time_units), (format_time):
don't add 30 seconds when formatting time, as float->int conversion
already truncates the value for us (#572284).
2009-02-21 Cosimo Cecchi <cosimoc@gnome.org>
* configure.in:

View file

@ -228,7 +228,7 @@ seconds_count_format_time_units (int seconds)
if (seconds < 60*60) {
/* minutes */
minutes = (seconds + 30) / 60;
minutes = seconds / 60;
return minutes;
}
@ -236,7 +236,7 @@ seconds_count_format_time_units (int seconds)
if (seconds < 60*60*4) {
/* minutes + hours */
minutes = (seconds - hours * 60 * 60 + 30) / 60;
minutes = (seconds - hours * 60 * 60) / 60;
return minutes + hours;
}
@ -260,7 +260,7 @@ format_time (int seconds)
}
if (seconds < 60*60) {
minutes = (seconds + 30) / 60;
minutes = seconds / 60;
return g_strdup_printf (ngettext ("%'d minute", "%'d minutes", minutes), minutes);
}
@ -269,7 +269,7 @@ format_time (int seconds)
if (seconds < 60*60*4) {
char *h, *m;
minutes = (seconds - hours * 60 * 60 + 30) / 60;
minutes = (seconds - hours * 60 * 60) / 60;
h = g_strdup_printf (ngettext ("%'d hour", "%'d hours", hours), hours);
m = g_strdup_printf (ngettext ("%'d minute", "%'d minutes", minutes), minutes);