summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rdate
diff options
context:
space:
mode:
authorkstailey <kstailey@openbsd.org>1997-01-21 17:44:05 +0000
committerkstailey <kstailey@openbsd.org>1997-01-21 17:44:05 +0000
commit9c7af293309a7f5b833809fc1c35a5edf07ae94f (patch)
tree26b27a9d40247409065851ff32a6eef1dd71f962 /usr.sbin/rdate
parentFixed potential buffer overflow. (diff)
downloadwireguard-openbsd-9c7af293309a7f5b833809fc1c35a5edf07ae94f.tar.xz
wireguard-openbsd-9c7af293309a7f5b833809fc1c35a5edf07ae94f.zip
make output look like that of date(1)
Diffstat (limited to 'usr.sbin/rdate')
-rw-r--r--usr.sbin/rdate/rdate.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/usr.sbin/rdate/rdate.c b/usr.sbin/rdate/rdate.c
index 270e4112677..f829c8fea06 100644
--- a/usr.sbin/rdate/rdate.c
+++ b/usr.sbin/rdate/rdate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rdate.c,v 1.5 1996/12/10 15:07:08 deraadt Exp $ */
+/* $OpenBSD: rdate.c,v 1.6 1997/01/21 17:44:05 kstailey Exp $ */
/* $NetBSD: rdate.c,v 1.4 1996/03/16 12:37:45 pk Exp $ */
/*
@@ -42,7 +42,7 @@
#if 0
from: static char rcsid[] = "$NetBSD: rdate.c,v 1.3 1996/02/22 06:59:18 thorpej Exp $";
#else
-static char rcsid[] = "$OpenBSD: rdate.c,v 1.5 1996/12/10 15:07:08 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: rdate.c,v 1.6 1997/01/21 17:44:05 kstailey Exp $";
#endif
#endif /* lint */
@@ -55,6 +55,7 @@ static char rcsid[] = "$OpenBSD: rdate.c,v 1.5 1996/12/10 15:07:08 deraadt Exp $
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
+#include <time.h>
/* seconds from midnight Jan 1900 - 1970 */
#if __STDC__
@@ -167,7 +168,13 @@ main(argc, argv)
}
if (!silent) {
- (void) fputs(ctime(&tim), stdout);
+ struct tm *ltm;
+ char buf[80];
+
+ ltm = localtime(&tim);
+ strftime(buf, 80, "%a %b %d %H:%M:%S %Z %Y\n", ltm);
+ (void) fputs(buf, stdout);
+
if (slidetime)
(void) fprintf(stdout,
"%s: adjust local clock by %d seconds\n",