Date: Mon, 14 Apr 1997 12:32:26 +0200 From: Martin Kammerhofer <dada@freepass.tu-graz.ac.at> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/3285: date option for pom(6) (phase of the moon) Message-ID: <199704141032.MAA13863@freepass.tu-graz.ac.at> Resent-Message-ID: <199704141040.DAA02602@freefall.freebsd.org>
index | next in thread | raw e-mail
>Number: 3285
>Category: bin
>Synopsis: date option for pom(6) (phase of the moon)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Mon Apr 14 03:40:12 PDT 1997
>Last-Modified:
>Originator: Martin Kammerhofer
>Organization:
Graz University of Technology
>Release: FreeBSD 2.2.1-RELEASE i386
>Environment:
>Description:
Maybe otherīs are too curious what phase the moon was on
that very special day...
The enhancement is only some 15 lines.
>How-To-Repeat:
>Fix:
--- /usr/src/games/pom/pom.c Wed Jul 17 22:13:33 1996
+++ /usr/home/dada/src/pom.c Sat Apr 5 20:04:03 1997
@@ -41,6 +41,7 @@
#ifndef lint
static const char sccsid[] = "@(#)pom.c 8.1 (Berkeley) 5/31/93";
+static const char rcsid[] = "@(#)$Id$";
#endif /* not lint */
/*
@@ -72,7 +73,9 @@
static double potm __P((double));
int
-main()
+main(argc, argv)
+int argc;
+char *argv[];
{
time_t tt;
struct tm *GMT;
@@ -81,6 +84,20 @@
(void) time(&tt);
GMT = gmtime(&tt);
+
+ if (argc == 4) { /* expect a date in YYYY MM DD format */
+ GMT = localtime(&tt);
+ sscanf(argv[1], "%d", &GMT->tm_year);
+ GMT->tm_year -= 1900;
+ sscanf(argv[2], "%d", &GMT->tm_mon);
+ GMT->tm_mon--; /* 0..11 */
+ sscanf(argv[3], "%d", &GMT->tm_mday); /* 1..31 */
+ GMT->tm_isdst = -2; /* i.e. 'guess' */
+ tt = mktime(GMT);
+ GMT = gmtime(&tt);
+ printf("%s", asctime(GMT));
+ }
+
days = (GMT->tm_yday + 1) + ((GMT->tm_hour +
(GMT->tm_min / 60.0) + (GMT->tm_sec / 3600.0)) / 24.0);
for (cnt = EPOCH; cnt < GMT->tm_year; ++cnt)
>Audit-Trail:
>Unformatted:
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704141032.MAA13863>
