Return a time string. */
| 180 | |
| 181 | /* Return a time string. */ |
| 182 | static char const * |
| 183 | time_string (STRUCT_UTMP const *utmp_ent) |
| 184 | { |
| 185 | static char buf[INT_STRLEN_BOUND (intmax_t) + sizeof "-%m-%d %H:%M"]; |
| 186 | struct tm *tmp = localtime (&utmp_ent->ut_ts.tv_sec); |
| 187 | |
| 188 | if (tmp) |
| 189 | { |
| 190 | strftime (buf, sizeof buf, time_format, tmp); |
| 191 | return buf; |
| 192 | } |
| 193 | else |
| 194 | return timetostr (utmp_ent->ut_ts.tv_sec, buf); |
| 195 | } |
| 196 | |
| 197 | /* Display a line of information about UTMP_ENT. */ |
| 198 |
no test coverage detected