Thu Jan 7 06:24:25 1999 Andrej Borsenkow <borsenkow.msk@sni.de>

* vfs/vfs.c (vfs_parse_filedate): If the date is less than 6 months
in the past, it is shown without year. In this case MC assumed
the current year which is wrong from Jan to Jun.
This commit is contained in:
Norbert Warmuth 1999-01-07 05:54:16 +00:00
parent e19f2af33f
commit d6a8e538fc
2 changed files with 25 additions and 3 deletions

View File

@ -1,3 +1,9 @@
Thu Jan 7 06:24:25 1999 Andrej Borsenkow <borsenkow.msk@sni.de>
* vfs.c (vfs_parse_filedate): If the date is less than 6 months
in the past, it is shown without year. In this case MC assumed
the current year which is wrong from Jan to Jun.
Thu Jan 7 03:47:35 1999 Timur I. Bakeyev <timur@com.bat.ru>
* vfs.c (parse_ls_lga): Fixed Y2K typo pointed by Alex.

View File

@ -1432,6 +1432,7 @@ int vfs_parse_filedate(int idx, time_t *t)
char *p, *pos;
int extfs_format_date = 0;
struct tm tim;
int got_year = 0;
/* Let's setup default time values */
tim.tm_year = current_year;
@ -1440,7 +1441,9 @@ int vfs_parse_filedate(int idx, time_t *t)
tim.tm_hour = 0;
tim.tm_min = 0;
tim.tm_sec = 0;
tim.tm_isdst = 0;
tim.tm_isdst = -1; /* My man says, in this case mktime computes
* correct dst offset
*/
p = columns [idx++];
@ -1487,17 +1490,30 @@ int vfs_parse_filedate(int idx, time_t *t)
}
if (is_num (idx)) {
if(is_time(columns[idx], &tim) || is_year(columns[idx], &tim)) {
if(is_time(columns[idx], &tim) || (got_year = is_year(columns[idx], &tim))) {
idx++;
if(is_num (idx) &&
(is_year(columns[idx], &tim) || is_time(columns[idx], &tim)))
((got_year = is_year(columns[idx], &tim)) || is_time(columns[idx], &tim)))
idx++; /* time & year or reverse */
} /* only time or date */
}
else
return 0; /* Nor time or date */
/*
* If the date is less than 6 months in the past, it is shown without year
* other dates in the past or future are shown with year but without time
* This does not check for years before 1900 ... I don't know, how
* to represent them at all
*/
if (!got_year &&
current_mon < 6 &&
current_mon < tim.tm_mon &&
tim.tm_mon - current_mon >= 6)
tim.tm_year -= 1;
if ((*t = mktime(&tim)) ==-1)
*t = 0;
return idx;