summaryrefslogtreecommitdiff
path: root/usr.sbin/rdate
diff options
context:
space:
mode:
authorkstailey <kstailey@cvs.openbsd.org>1997-01-21 17:44:06 +0000
committerkstailey <kstailey@cvs.openbsd.org>1997-01-21 17:44:06 +0000
commitbf84d83b5c12903c191671bb5a3592e02aa525cd (patch)
tree2c4865716e49c0d019a0f9768bbb7388b3f71074 /usr.sbin/rdate
parent459d969f3c6054645114010bbb663bbbe7a72e90 (diff)
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",