Don't assume that time_t is long.

This commit is contained in:
Bruce Evans 1998-06-29 15:52:49 +00:00
parent eeae79cc34
commit 39470616b1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=37259
2 changed files with 8 additions and 10 deletions

View File

@ -3918,12 +3918,6 @@ cm_dotless (arg, start, end)
}
}
#if defined (__osf__)
#define LOCALTIME_CAST(x) (time_t *)(x)
#else
#define LOCALTIME_CAST(x) (x)
#endif
void
cm_today (arg)
int arg;
@ -3933,8 +3927,8 @@ cm_today (arg)
"August", "September", "October", "November", "December" };
if (arg == START)
{
long timer = time (0);
struct tm *ts = localtime (LOCALTIME_CAST (&timer));
time_t timer = time (0);
struct tm *ts = localtime (&timer);
add_word_args
("%d %s %d",
(ts -> tm_mday),

View File

@ -184,11 +184,13 @@ stime_arg1(arg, tvp)
char *arg;
struct timeval *tvp;
{
time_t now;
struct tm *t;
int yearset;
char *p;
/* Start with the current time. */
if ((t = localtime(&tvp[0].tv_sec)) == NULL)
now = tvp[0].tv_sec;
if ((t = localtime(&now)) == NULL)
err(1, "localtime");
/* [[CC]YY]MMDDhhmm[.SS] */
if ((p = strchr(arg, '.')) == NULL)
@ -246,9 +248,11 @@ stime_arg2(arg, year, tvp)
int year;
struct timeval *tvp;
{
time_t now;
struct tm *t;
/* Start with the current time. */
if ((t = localtime(&tvp[0].tv_sec)) == NULL)
now = tvp[0].tv_sec;
if ((t = localtime(&now)) == NULL)
err(1, "localtime");
t->tm_mon = ATOI2(arg); /* MMDDhhmm[yy] */