Changeset 525 for trunk/gtk/util.c
- Timestamp:
- Jul 4, 2006, 10:31:14 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gtk/util.c
r320 r525 85 85 } 86 86 87 #define SECONDS(s) ((s) % 60) 88 #define MINUTES(s) ((s) / 60 % 60) 89 #define HOURS(s) ((s) / 60 / 60 % 24) 90 #define DAYS(s) ((s) / 60 / 60 / 24 % 7) 91 #define WEEKS(s) ((s) / 60 / 60 / 24 / 7) 92 93 char * 94 readabletime(int secs) { 95 if(60 > secs) 96 return g_strdup_printf(_("%i %s"), 97 SECONDS(secs), ngettext("second", "seconds", SECONDS(secs))); 98 else if(60 * 60 > secs) 99 return g_strdup_printf(_("%i %s %i %s"), 100 MINUTES(secs), ngettext("minute", "minutes", MINUTES(secs)), 101 SECONDS(secs), ngettext("second", "seconds", SECONDS(secs))); 102 else if(60 * 60 * 24 > secs) 103 return g_strdup_printf(_("%i %s %i %s"), 104 HOURS(secs), ngettext("hour", "hours", HOURS(secs)), 105 MINUTES(secs), ngettext("minute", "minutes", MINUTES(secs))); 106 else if(60 * 60 * 24 * 7 > secs) 107 return g_strdup_printf(_("%i %s %i %s"), 108 DAYS(secs), ngettext("day", "days", DAYS(secs)), 109 HOURS(secs), ngettext("hour", "hours", HOURS(secs))); 110 else 111 return g_strdup_printf(_("%i %s %i %s"), 112 WEEKS(secs), ngettext("week", "weeks", WEEKS(secs)), 113 DAYS(secs), ngettext("hour", "hours", DAYS(secs))); 114 } 115 87 116 char * 88 117 ratiostr(guint64 down, guint64 up) {
Note: See TracChangeset
for help on using the changeset viewer.