(make_fileinfo): make sure to always call time, ctime, and gmtime with

`time_t's.  there were some types (like in lastlog) that we believed
to always be time_t.  this has proven wrong on Solaris 8 in 64-bit
mode, where they are stored as 32-bit quantities but time_t has gone
up to 64 bits


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8067 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2000-03-26 19:47:59 +00:00
parent 85ff7204cc
commit c4c623ae05

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999 Kungliga Tekniska H<>gskolan
* Copyright (c) 1999 - 2000 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -177,9 +177,10 @@ make_fileinfo(const char *filename, struct fileinfo *file, int flags)
{
time_t t = time(NULL);
struct tm *tm = localtime(&st->st_mtime);
if((t - st->st_mtime > 6*30*24*60*60) ||
(st->st_mtime - t > 6*30*24*60*60))
time_t st_mtime = st->st_mtime;
struct tm *tm = localtime(&st_mtime);
if((t - st_mtime > 6*30*24*60*60) ||
(st_mtime - t > 6*30*24*60*60))
strftime(buf, sizeof(buf), "%b %e %Y", tm);
else
strftime(buf, sizeof(buf), "%b %e %H:%M", tm);