diff options
author | jeremy <jeremy@NetBSD.org> | 1998-06-13 01:09:22 +0000 |
---|---|---|
committer | jeremy <jeremy@NetBSD.org> | 1998-06-13 01:09:22 +0000 |
commit | db90312471536b4db77916558e5ba7bf7632ad2f (patch) | |
tree | 4bbc4a077bbf8b48883c06e93fb3610641c0128a /pom | |
parent | 1ee27fa489453810240f86207f73bfe80568dfcc (diff) | |
download | bsdgames-darwin-db90312471536b4db77916558e5ba7bf7632ad2f.tar.gz bsdgames-darwin-db90312471536b4db77916558e5ba7bf7632ad2f.tar.zst bsdgames-darwin-db90312471536b4db77916558e5ba7bf7632ad2f.zip |
Added optional argument for calculating the phase of the moon for a specified
date, rather than the current time.
Diffstat (limited to 'pom')
-rw-r--r-- | pom/pom.6 | 14 | ||||
-rw-r--r-- | pom/pom.c | 14 |
2 files changed, 23 insertions, 5 deletions
@@ -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 @@ -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 + |