diff options
author | Mike Pritchard <mpp@FreeBSD.org> | 1997-01-11 19:15:53 +0000 |
---|---|---|
committer | Mike Pritchard <mpp@FreeBSD.org> | 1997-01-11 19:15:53 +0000 |
commit | f173abd010c88992cf70110a49d17c4b004e6c09 (patch) | |
tree | 4fdc842d498c17701f57a79ca7f7171cc1ddd262 /bin/ls/print.c | |
parent | b1e21161bf8f6fe63cfbba6c2aac956382038c88 (diff) | |
download | src-f173abd010c88992cf70110a49d17c4b004e6c09.tar.gz src-f173abd010c88992cf70110a49d17c4b004e6c09.zip |
Make ls include the year when displaying times that are more than
6 months into the future. Closes PR# 1657.
Submitted by: Sakari Jalowaara <sja.home.tekla.fi>
Notes
Notes:
svn path=/head/; revision=21545
Diffstat (limited to 'bin/ls/print.c')
-rw-r--r-- | bin/ls/print.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/ls/print.c b/bin/ls/print.c index e7b63f0ba59b..aee00ea8adc9 100644 --- a/bin/ls/print.c +++ b/bin/ls/print.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: print.c,v 1.8 1996/01/20 10:31:14 mpp Exp $ + * $Id: print.c,v 1.9 1996/12/14 06:03:28 steve Exp $ */ #ifndef lint @@ -231,6 +231,10 @@ printtime(ftime) { int i; char longstring[80]; + static time_t now; + + if (now == 0) + now = time(NULL); strftime(longstring, sizeof(longstring), "%c", localtime(&ftime)); for (i = 4; i < 11; ++i) @@ -240,7 +244,7 @@ printtime(ftime) if (f_sectime) for (i = 11; i < 24; i++) (void)putchar(longstring[i]); - else if (ftime + SIXMONTHS > time(NULL)) + else if (ftime + SIXMONTHS > now && ftime < now + SIXMONTHS) for (i = 11; i < 16; ++i) (void)putchar(longstring[i]); else { |