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

Function show_date

src/show-date.c:19–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17 to STDOUT. */
18
19extern bool
20show_date (char const *format, struct timespec when, timezone_t tz)
21{
22 struct tm tm;
23
24 if (!localtime_rz (tz, &when.tv_sec, &tm))
25 {
26 char buf[INT_BUFSIZE_BOUND (intmax_t)];
27 error (0, 0, _("time %s is out of range"),
28 quote (timetostr (when.tv_sec, buf)));
29 return false;
30 }
31
32 if (fprintftime (stdout, format, &tm, tz, when.tv_nsec) < 0)
33 {
34 if (! ferror (stdout)) /* otherwise it will be diagnosed later. */
35 error (0, errno, _("fprintftime error"));
36 return false;
37 }
38
39 return true;
40}

Callers 2

print_sizeFunction · 0.85
show_date_helperFunction · 0.85

Calls 1

timetostrFunction · 0.85

Tested by

no test coverage detected