summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosef Karthauser <joe@FreeBSD.org>2000-06-18 22:18:04 +0000
committerJosef Karthauser <joe@FreeBSD.org>2000-06-18 22:18:04 +0000
commit97e4e97bd1d7e665a045fcb4dca3bed3602dd229 (patch)
tree659ad12c2e79b018905a1a1e2405ed1db1ec0f18
parent6019e6208ff3bc5fd13ae2cadd920d784f3bbeca (diff)
Notes
-rw-r--r--bin/ls/print.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/bin/ls/print.c b/bin/ls/print.c
index 596825c7d7d8..d397c1c7773f 100644
--- a/bin/ls/print.c
+++ b/bin/ls/print.c
@@ -293,30 +293,25 @@ static void
printtime(ftime)
time_t ftime;
{
- int i;
char longstring[80];
static time_t now;
+ const char *format;
if (now == 0)
now = time(NULL);
- strftime(longstring, sizeof(longstring), "%c", localtime(&ftime));
- for (i = 4; i < 11; ++i)
- (void)putchar(longstring[i]);
-
#define SIXMONTHS ((365 / 2) * 86400)
if (f_sectime)
- for (i = 11; i < 24; i++)
- (void)putchar(longstring[i]);
+ /* Mmm dd hh:mm:ss yyyy */
+ format = "%b %e %T %Y ";
else if (ftime + SIXMONTHS > now && ftime < now + SIXMONTHS)
- for (i = 11; i < 16; ++i)
- (void)putchar(longstring[i]);
- else {
- (void)putchar(' ');
- for (i = 20; i < 24; ++i)
- (void)putchar(longstring[i]);
- }
- (void)putchar(' ');
+ /* Mmm dd hh:mm */
+ format = "%b %e %R ";
+ else
+ /* Mmm dd yyyy */
+ format = "%b %e %Y ";
+ strftime(longstring, sizeof(longstring), format, localtime(&ftime));
+ fputs(longstring, stdout);
}
static int