version 1.23, 2018/09/18 15:14:06 |
version 1.24, 2023/08/06 19:33:54 |
|
|
} |
} |
small = (sizeof(secs) == 4); |
small = (sizeof(secs) == 4); |
data = secs; |
data = secs; |
small = 1; |
|
tm = localtime(&secs); |
tm = localtime(&secs); |
(void)strftime(path, sizeof(path), timefmt, tm); |
(void)strftime(path, sizeof(path), timefmt, tm); |
sdata = path; |
sdata = path; |
|
|
(void)snprintf(tmp, sizeof(tmp), "%d", size); |
(void)snprintf(tmp, sizeof(tmp), "%d", size); |
(void)strlcat(lfmt, tmp, sizeof(lfmt)); |
(void)strlcat(lfmt, tmp, sizeof(lfmt)); |
} |
} |
(void)strlcat(lfmt, "d", sizeof(lfmt)); |
(void)strlcat(lfmt, "lld", sizeof(lfmt)); |
n = snprintf(buf, blen, lfmt, secs); |
n = snprintf(buf, blen, lfmt, (long long)secs); |
return (n >= blen ? blen : n); |
return (n >= blen ? blen : n); |
} |
} |
|
|
|
|
(void)snprintf(tmp, sizeof(tmp), "%d", size); |
(void)snprintf(tmp, sizeof(tmp), "%d", size); |
(void)strlcat(lfmt, tmp, sizeof(lfmt)); |
(void)strlcat(lfmt, tmp, sizeof(lfmt)); |
} |
} |
(void)strlcat(lfmt, "d", sizeof(lfmt)); |
(void)strlcat(lfmt, "lld", sizeof(lfmt)); |
|
|
/* |
/* |
* The stuff after the decimal point always needs zero |
* The stuff after the decimal point always needs zero |
|
|
* We can "print" at most nine digits of precision. The |
* We can "print" at most nine digits of precision. The |
* rest we will pad on at the end. |
* rest we will pad on at the end. |
*/ |
*/ |
(void)snprintf(tmp, sizeof(tmp), "%dd", prec > 9 ? 9 : prec); |
(void)snprintf(tmp, sizeof(tmp), "%dld", prec > 9 ? 9 : prec); |
(void)strlcat(lfmt, tmp, sizeof(lfmt)); |
(void)strlcat(lfmt, tmp, sizeof(lfmt)); |
|
|
/* |
/* |
|
|
* Use the format, and then tack on any zeroes that |
* Use the format, and then tack on any zeroes that |
* might be required to make up the requested precision. |
* might be required to make up the requested precision. |
*/ |
*/ |
l = snprintf(buf, blen, lfmt, secs, nsecs); |
l = snprintf(buf, blen, lfmt, (long long)secs, nsecs); |
if (l >= blen) |
if (l >= blen) |
return (l); |
return (l); |
for (; prec > 9 && l < blen; prec--, l++) |
for (; prec > 9 && l < blen; prec--, l++) |