Return a string representing the time between WHEN and now. BOOTTIME is the time of last reboot. FIXME: locale? */
| 177 | BOOTTIME is the time of last reboot. |
| 178 | FIXME: locale? */ |
| 179 | static char const * |
| 180 | idle_string (time_t when, time_t boottime) |
| 181 | { |
| 182 | static time_t now = TYPE_MINIMUM (time_t); |
| 183 | |
| 184 | if (now == TYPE_MINIMUM (time_t)) |
| 185 | time (&now); |
| 186 | |
| 187 | int seconds_idle; |
| 188 | if (boottime < when && when <= now |
| 189 | && ! ckd_sub (&seconds_idle, now, when) |
| 190 | && seconds_idle < 24 * 60 * 60) |
| 191 | { |
| 192 | if (seconds_idle < 60) |
| 193 | return " . "; |
| 194 | else |
| 195 | { |
| 196 | static char idle_hhmm[IDLESTR_LEN]; |
| 197 | sprintf (idle_hhmm, "%02d:%02d", |
| 198 | seconds_idle / (60 * 60), |
| 199 | (seconds_idle % (60 * 60)) / 60); |
| 200 | return idle_hhmm; |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | return _(" old "); |
| 205 | } |
| 206 | |
| 207 | /* Return a time string. */ |
| 208 | static char const * |