version 1.14, 2013/04/23 18:08:40 |
version 1.15, 2014/01/10 04:53:35 |
|
|
static void printtime(time_t); |
static void printtime(time_t); |
|
|
#define NAME_WIDTH 8 |
#define NAME_WIDTH 8 |
|
#define DATELEN 64 |
|
#define SIXMONTHS ((DAYSPERNYEAR / 2) * SECSPERDAY) |
|
|
void |
void |
printlong(char *name, char *accpath, struct stat *sb) |
printlong(char *name, char *accpath, struct stat *sb) |
|
|
static void |
static void |
printtime(time_t ftime) |
printtime(time_t ftime) |
{ |
{ |
int i; |
char f_date[DATELEN]; |
char *longstring; |
static time_t now; |
|
static int now_set = 0; |
|
|
longstring = ctime(&ftime); |
if (! now_set) { |
for (i = 4; i < 11; ++i) |
now = time(NULL); |
(void)putchar(longstring[i]); |
now_set = 1; |
|
|
#define SIXMONTHS ((DAYSPERNYEAR / 2) * SECSPERDAY) |
|
if (ftime + SIXMONTHS > time(NULL)) |
|
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(' '); |
|
|
/* |
|
* convert time to string, and print |
|
*/ |
|
if (strftime(f_date, sizeof(f_date), |
|
(ftime + SIXMONTHS <= now || ftime > now) ? "%b %e %Y" : |
|
"%b %e %H:%M", localtime(&ftime)) == 0) |
|
f_date[0] = '\0'; |
|
|
|
printf("%s ", f_date); |
} |
} |
|
|
static void |
static void |