Added optional argument for calculating the phase of the moon for a specified

date, rather than the current time.
This commit is contained in:
jeremy 1998-06-13 01:09:22 +00:00
parent 254edea7e0
commit 4dc771924a
2 changed files with 23 additions and 5 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pom.6,v 1.5 1997/10/10 16:46:56 lukem Exp $
.\" $NetBSD: pom.6,v 1.6 1998/06/13 01:09:22 jeremy Exp $
.\"
.\" Copyright (c) 1989, 1993
.\" The Regents of the University of California. All rights reserved.
@ -41,9 +41,21 @@
.Nd display the phase of the moon
.Sh SYNOPSIS
.Nm
.Op Ar secs
.Sh DESCRIPTION
The
.Nm
utility displays the current phase of the moon.
Useful for selecting software completion target dates and predicting
managerial behavior.
.Pp
.Bl -tag -width secs
.It Ar secs
Display the phase of the moon for the date represented by
.Ar secs
seconds past the Epoch
(Midnight, January 1, 1970 GMT).
If
.Ar secs
is unspecified, the current time is used.
.El

View File

@ -1,4 +1,4 @@
/* $NetBSD: pom.c,v 1.8 1997/10/12 01:01:39 lukem Exp $ */
/* $NetBSD: pom.c,v 1.9 1998/06/13 01:09:22 jeremy Exp $ */
/*
* Copyright (c) 1989, 1993
@ -45,7 +45,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)pom.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: pom.c,v 1.8 1997/10/12 01:01:39 lukem Exp $");
__RCSID("$NetBSD: pom.c,v 1.9 1998/06/13 01:09:22 jeremy Exp $");
#endif
#endif /* not lint */
@ -65,6 +65,7 @@ __RCSID("$NetBSD: pom.c,v 1.8 1997/10/12 01:01:39 lukem Exp $");
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <tzfile.h>
#define PI 3.141592654
@ -93,8 +94,13 @@ main(argc, argv)
double days, today, tomorrow;
int cnt;
if (gettimeofday(&tp,&tzp))
err(1, "gettimeofday");
if (argc > 1) {
tp.tv_sec = atoi(argv[1]);
tp.tv_usec = 0;
} else {
if (gettimeofday(&tp,&tzp))
err(1, "gettimeofday");
}
tmpt = tp.tv_sec;
GMT = gmtime(&tmpt);
days = (GMT->tm_yday + 1) + ((GMT->tm_hour +