MCPcopy Create free account
hub / github.com/coreutils/coreutils / time_string

Function time_string

src/who.c:208–221  ·  view source on GitHub ↗

Return a time string. */

Source from the content-addressed store, hash-verified

206
207/* Return a time string. */
208static char const *
209time_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

Callers 7

print_userFunction · 0.70
print_boottimeFunction · 0.70
print_deadprocsFunction · 0.70
print_loginFunction · 0.70
print_initspawnFunction · 0.70
print_clockchangeFunction · 0.70
print_runlevelFunction · 0.70

Calls 1

timetostrFunction · 0.85

Tested by

no test coverage detected