-/* $OpenBSD: pom.c,v 1.25 2016/12/01 20:08:59 fcambus Exp $ */
+/* $OpenBSD: pom.c,v 1.26 2017/12/23 20:53:07 cheloha Exp $ */
/* $NetBSD: pom.c,v 1.6 1996/02/06 22:47:29 jtc Exp $ */
/*
*
*/
-#include <sys/time.h>
#include <ctype.h>
#include <err.h>
#include <math.h>
int
main(int argc, char *argv[])
{
- struct timeval tp;
- struct timezone tzp;
struct tm *GMT;
time_t tmpt;
double days, today, tomorrow;
strftime(buf, sizeof(buf), "%a %Y %b %e %H:%M:%S (%Z)",
localtime(&tmpt));
printf("%s: ", buf);
- } else {
- if (gettimeofday(&tp,&tzp))
- err(1, "gettimeofday");
- tmpt = tp.tv_sec;
- }
+ } else
+ tmpt = time(NULL);
GMT = gmtime(&tmpt);
days = (GMT->tm_yday + 1) + ((GMT->tm_hour +
(GMT->tm_min / 60.0) + (GMT->tm_sec / 3600.0)) / 24.0);
-/* $OpenBSD: pr.c,v 1.40 2017/11/02 09:52:04 jca Exp $ */
+/* $OpenBSD: pr.c,v 1.41 2017/12/23 20:53:07 cheloha Exp $ */
/*-
* Copyright (c) 1991 Keith Muller.
*/
#include <sys/types.h>
-#include <sys/time.h>
#include <sys/stat.h>
#include <ctype.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include <unistd.h>
#include "pr.h"
nxtfile(int argc, char *argv[], char **fname, char *buf, int dt)
{
FILE *inf = NULL;
- struct timeval tv;
struct tm *timeptr = NULL;
struct stat statbuf;
time_t curtime;
*fname = FNAME;
if (nohead)
return(inf);
- if (gettimeofday(&tv, NULL) < 0) {
- ++errcnt;
- ferrout("pr: cannot get time of day, %s\n",
- strerror(errno));
- eoptind = argc - 1;
- return(NULL);
- }
- curtime = tv.tv_sec;
+ curtime = time(NULL);;
timeptr = localtime(&curtime);
}
for (; eoptind < argc; ++eoptind) {
++eoptind;
if (nohead || (dt && twice))
return(inf);
- if (gettimeofday(&tv, NULL) < 0) {
- ++errcnt;
- ferrout("pr: cannot get time of day, %s\n",
- strerror(errno));
- return(NULL);
- }
- curtime = tv.tv_sec;
+ curtime = time(NULL);
timeptr = localtime(&curtime);
} else {
/*
return(inf);
if (dt) {
- if (gettimeofday(&tv, NULL) < 0) {
- ++errcnt;
- ferrout("pr: cannot get time of day, %s\n",
- strerror(errno));
- return(NULL);
- }
- curtime = tv.tv_sec;
+ curtime = time(NULL);
timeptr = localtime(&curtime);
} else {
if (fstat(fileno(inf), &statbuf) < 0) {
-/* $OpenBSD: arp.c,v 1.79 2017/04/19 05:36:12 natano Exp $ */
+/* $OpenBSD: arp.c,v 1.80 2017/12/23 20:53:07 cheloha Exp $ */
/* $NetBSD: arp.c,v 1.12 1995/04/24 13:25:18 cgd Exp $ */
/*
#include <sys/file.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
-#include <sys/time.h>
#include <sys/ioctl.h>
#include <net/bpf.h>
#include <net/if.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include <paths.h>
#include <unistd.h>
#include <limits.h>
doing_proxy = flags = export_only = 0;
while (argc-- > 0) {
if (strncmp(argv[0], "temp", 4) == 0) {
- struct timeval now;
-
- gettimeofday(&now, 0);
- expire_time = now.tv_sec + 20 * 60;
+ expire_time = time(NULL) + 20 * 60;
if (flags & RTF_PERMANENT_ARP) {
/* temp or permanent, not both */
usage();
char ifix_buf[IFNAMSIZ], *ifname, *host;
struct hostent *hp = NULL;
int addrwidth, llwidth, ifwidth ;
- struct timeval now;
+ time_t now;
- gettimeofday(&now, 0);
+ now = time(NULL);
if (nflag == 0)
hp = gethostbyaddr((caddr_t)&(sin->sin_addr),
printf(" %-9.9s", "permanent");
else if (rtm->rtm_rmx.rmx_expire == 0)
printf(" %-9.9s", "static");
- else if (rtm->rtm_rmx.rmx_expire > now.tv_sec)
+ else if (rtm->rtm_rmx.rmx_expire > now)
printf(" %-9.9s",
- sec2str(rtm->rtm_rmx.rmx_expire - now.tv_sec));
+ sec2str(rtm->rtm_rmx.rmx_expire - now));
else
printf(" %-9.9s", "expired");