Return a time string. */
| 206 | |
| 207 | /* Return a time string. */ |
| 208 | static char const * |
| 209 | time_string (STRUCT_UTMP const *utmp_ent) |
| 210 | { |
| 211 | static char buf[INT_STRLEN_BOUND (intmax_t) + sizeof "-%m-%d %H:%M"]; |
| 212 | struct tm *tmp = localtime (&utmp_ent->ut_ts.tv_sec); |
| 213 | |
| 214 | if (tmp) |
| 215 | { |
| 216 | strftime (buf, sizeof buf, time_format, tmp); |
| 217 | return buf; |
| 218 | } |
| 219 | else |
| 220 | return timetostr (utmp_ent->ut_ts.tv_sec, buf); |
| 221 | } |
| 222 | |
| 223 | /* Print formatted output line. Uses mostly arbitrary field sizes, probably |
| 224 | will need tweaking if any of the localization stuff is done, or for 64 bit |
no test coverage detected