mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-12 09:58:36 +00:00
Don't assume that time_t is long.
This commit is contained in:
parent
7040dc3f37
commit
c2deb6082e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=37266
@ -42,7 +42,7 @@ static const char copyright[] =
|
|||||||
static char sccsid[] = "@(#)from: sysctl.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)from: sysctl.c 8.1 (Berkeley) 6/6/93";
|
||||||
#endif
|
#endif
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
"$Id: sysctl.c,v 1.15 1997/10/20 12:53:54 charnier Exp $";
|
"$Id: sysctl.c,v 1.16 1997/11/18 03:37:45 jdp Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -245,13 +245,15 @@ static int
|
|||||||
S_timeval(int l2, void *p)
|
S_timeval(int l2, void *p)
|
||||||
{
|
{
|
||||||
struct timeval *tv = (struct timeval*)p;
|
struct timeval *tv = (struct timeval*)p;
|
||||||
|
time_t tv_sec;
|
||||||
char *p1, *p2;
|
char *p1, *p2;
|
||||||
|
|
||||||
if (l2 != sizeof *tv)
|
if (l2 != sizeof *tv)
|
||||||
err(1, "S_timeval %d != %d", l2, sizeof *tv);
|
err(1, "S_timeval %d != %d", l2, sizeof *tv);
|
||||||
printf("{ sec = %ld, usec = %ld } ",
|
printf("{ sec = %ld, usec = %ld } ",
|
||||||
tv->tv_sec, tv->tv_usec);
|
tv->tv_sec, tv->tv_usec);
|
||||||
p1 = strdup(ctime(&tv->tv_sec));
|
tv_sec = tv->tv_sec;
|
||||||
|
p1 = strdup(ctime(&tv_sec));
|
||||||
for (p2=p1; *p2 ; p2++)
|
for (p2=p1; *p2 ; p2++)
|
||||||
if (*p2 == '\n')
|
if (*p2 == '\n')
|
||||||
*p2 = '\0';
|
*p2 = '\0';
|
||||||
|
@ -42,7 +42,7 @@ static const char copyright[] =
|
|||||||
static char sccsid[] = "@(#)from: sysctl.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)from: sysctl.c 8.1 (Berkeley) 6/6/93";
|
||||||
#endif
|
#endif
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
"$Id: sysctl.c,v 1.15 1997/10/20 12:53:54 charnier Exp $";
|
"$Id: sysctl.c,v 1.16 1997/11/18 03:37:45 jdp Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -245,13 +245,15 @@ static int
|
|||||||
S_timeval(int l2, void *p)
|
S_timeval(int l2, void *p)
|
||||||
{
|
{
|
||||||
struct timeval *tv = (struct timeval*)p;
|
struct timeval *tv = (struct timeval*)p;
|
||||||
|
time_t tv_sec;
|
||||||
char *p1, *p2;
|
char *p1, *p2;
|
||||||
|
|
||||||
if (l2 != sizeof *tv)
|
if (l2 != sizeof *tv)
|
||||||
err(1, "S_timeval %d != %d", l2, sizeof *tv);
|
err(1, "S_timeval %d != %d", l2, sizeof *tv);
|
||||||
printf("{ sec = %ld, usec = %ld } ",
|
printf("{ sec = %ld, usec = %ld } ",
|
||||||
tv->tv_sec, tv->tv_usec);
|
tv->tv_sec, tv->tv_usec);
|
||||||
p1 = strdup(ctime(&tv->tv_sec));
|
tv_sec = tv->tv_sec;
|
||||||
|
p1 = strdup(ctime(&tv_sec));
|
||||||
for (p2=p1; *p2 ; p2++)
|
for (p2=p1; *p2 ; p2++)
|
||||||
if (*p2 == '\n')
|
if (*p2 == '\n')
|
||||||
*p2 = '\0';
|
*p2 = '\0';
|
||||||
|
Loading…
Reference in New Issue
Block a user