summaryrefslogtreecommitdiffstats
path: root/bin/ls/print.c
diff options
context:
space:
mode:
authormpp <mpp@FreeBSD.org>1997-01-11 19:15:53 +0000
committermpp <mpp@FreeBSD.org>1997-01-11 19:15:53 +0000
commit290bb61e140b751ca0823ac2b8e1957e41dbd339 (patch)
tree4fdc842d498c17701f57a79ca7f7171cc1ddd262 /bin/ls/print.c
parent588524edebc65a9379af6fd078fdc786b18d07dd (diff)
downloadFreeBSD-src-290bb61e140b751ca0823ac2b8e1957e41dbd339.zip
FreeBSD-src-290bb61e140b751ca0823ac2b8e1957e41dbd339.tar.gz
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>
Diffstat (limited to 'bin/ls/print.c')
-rw-r--r--bin/ls/print.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/ls/print.c b/bin/ls/print.c
index e7b63f0..aee00ea 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 {
OpenPOWER on IntegriCloud