v09i062: Sunclock - a world-view of the day, Part01/01
John Mackin
john at cs.su.oz.au
Mon Oct 1 03:13:06 AEST 1990
Submitted-by: John Mackin <john at cs.su.oz.au>
Posting-number: Volume 9, Issue 62
Archive-name: sunclock/part01
# This is a shell archive. Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by john on Sun Sep 30 21:41:46 EST 1990
# Contents: README sunclock.man Makefile.dist Imakefile sunclock.h bitmaps.c
# bitmaps.h icon.bits.h large.bits.h astro.c sunclock.c patchlevel.h
echo x - README
sed 's/^@//' > "README" <<'@//E*O*F README//'
Sun Clock - X11 Version 1.0
X11 version by John Mackin, <john at cs.su.oz.AU>, based on a Suntools program
by John Walker, <kelvin at acad.uu.NET>.
This program is a clock that shows which portion of the Earth's surface is
illuminated by the Sun. It is designed to be usually iconic, but can be
opened for a larger display with the time updated every second and both the
local timezone and UTC displayed. The Suntools version had a menu that
allowed you to speed up time, show different dates, etc., but I have
never implemented any of that in the X version; there is some support
for it in the code, however.
The program should have been written using Xt rather than raw Xlib, and I
tried that at first. I couldn't get the icon window to work, though, so I
abandoned that version. Hence, the program does _not_ accept most Xt-style
command line options; valid options are given in the manual page.
The program has been tested on a number of different clients (MIPS, Sun,
VAX) and servers (MIPS colour console, Sun MIT mono, NCD-16/19), under X11R3
and R4. If you find bugs, please report them to me, john at cs.su.oz.AU.
To build the program, decide whether you want to use imake or not. If you
don't, link Makefile.dist to Makefile, and edit it, otherwise edit the
Imakefile and use xmkmf. The program uses two fonts, one for the icon
display and one for the large window display. The names of these fonts
are compiled in. The font names comes from -DBIGFONT and -DSMALLFONT
in the Makefile. If you are not using imake, you will need to supply
a -DSYSV option if you are System V. You should supply -DNEW_CTIME if
you are using the table-driven ctime and a "struct tm" contains
a tm_zone field. If neither of the ways of getting the local timezone
name works on your system, please let me know.
The original Suntools program, in case you want it, was posted as Volume 1,
Issue 79 of comp.sources.sun.
This program is public domain and may be freely copied as long as the
notices at the top of sunclock.c remain intact.
@//E*O*F README//
chmod u=rw,g=,o= README
echo x - sunclock.man
sed 's/^@//' > "sunclock.man" <<'@//E*O*F sunclock.man//'
@.TH SUNCLOCK 1
@.SH NAME
sunclock \- show illuminated portion of Earth
@.SH SYNOPSIS
@.B sunclock
[
@.I options
]
@.SH DESCRIPTION
@.I sunclock
is an X11 application that displays a map of the Earth and
indicates the illuminated portion of the globe by drawing
sunlit areas dark on light, night areas as light on dark.
It also displays the current date and time.
@.SH OPTIONS
The program does not use the X Toolkit, and hence only those
options explicitly enumerated below may be used. Neither are
any resources used.
@.TP
@.B \-version
Show program version and patch level, and then exit.
@.TP
@.BI "\-display " dispname
Give the name of the X server to contact.
@.TP
@.B \-iconic
Start iconic. Usually you will want to specify this option.
@.TP
@.BI "\-geometry " +x+y
Specify the position of the window. Only the position is used; any size
information given is ignored.
@.TP
@.BI "\-icongeometry " +x+y
Specify the position of the icon. Only the position is used; any size
information given is ignored.
@.SH "HOW IT WORKS"
@.I sunclock
calculates the position of the Sun using the algorithm in chapter 18 of:
@.PP
@.I "Astronomical Formulae for Calculators"
by Jean Meeus, Third Edition, Richmond: Willmann-Bell, 1985.
@.PP
and Mercator projects the illuminated area onto map image. The
Sun's position is calculated to better than one arc-second
in accuracy.
@.SH BUGS
The maps are not rescaled if you resize the open window or icon. (I don't want
to have to store a vector database for the map.) The program contravenes
section 4.1.9 of the ICCCM in that its icon window is a fixed size, and any
WM_ICON_SIZE property of the root window is ignored.
@.PP
The illuminated area shown is the area which would be sunlit
if the Earth had no atmosphere. The actual illuminated area is
larger because of atmospheric refraction and twilight.
@.SH AUTHOR
John Mackin, Basser Department of Computer Science, University of Sydney,
Sydney, Australia; <john at cs.su.oz.AU>. Based on a Suntools program
by John Walker, Autodesk, Inc.; <kelvin at acad.uu.NET>.
@//E*O*F sunclock.man//
chmod u=rw,g=,o= sunclock.man
echo x - Makefile.dist
sed 's/^@//' > "Makefile.dist" <<'@//E*O*F Makefile.dist//'
#
# Compile options:
#
# Set -DSYSV if on System V
# Set -DNEW_CTIME if using the table-driven version of ctime (i.e., if
# your struct tm contains a tm_zone field)
# Set -DBIGFONT= and -DSMALLFONT= whatever fonts you like
# Pick -O or -g
#
CFLAGS=-DBIGFONT=\"9x15\" -DSMALLFONT=\"6x10\" -g
OFILES=sunclock.o bitmaps.o astro.o
sunclock: $(OFILES)
cc $(CFLAGS) $(OFILES) -o $@ -lX11 -lm
@//E*O*F Makefile.dist//
chmod u=rw,g=,o= Makefile.dist
echo x - Imakefile
sed 's/^@//' > "Imakefile" <<'@//E*O*F Imakefile//'
#
# Compile options:
#
# Set -DNEW_CTIME if using the table-driven version of ctime (i.e., if
# your struct tm contains a tm_zone field)
# Set -DBIGFONT= and -DSMALLFONT= whatever fonts you like
# Pick -O or -g
#
CDEBUGFLAGS=-DBIGFONT=\"9x15\" -DSMALLFONT=\"6x10\" -g
SRCS=sunclock.c bitmaps.c astro.c
OBJS=sunclock.o bitmaps.o astro.o
LOCAL_LIBRARIES=$(XLIB) -lm
DEPLIBS= # I don't know what I'm doing, and I hate imake!
ComplexProgramTarget(sunclock)
@//E*O*F Imakefile//
chmod u=rw,g=,o= Imakefile
echo x - sunclock.h
sed 's/^@//' > "sunclock.h" <<'@//E*O*F sunclock.h//'
/*
* Sun clock definitions.
*/
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include "patchlevel.h"
#include "bitmaps.h"
#define abs(x) ((x) < 0 ? (-(x)) : x) /* Absolute value */
#define sgn(x) (((x) < 0) ? -1 : ((x) > 0 ? 1 : 0)) /* Extract sign */
#define dtr(x) ((x) * (PI / 180.0)) /* Degree->Radian */
#define rtd(x) ((x) / (PI / 180.0)) /* Radian->Degree */
#define fixangle(a) ((a) - 360.0 * (floor((a) / 360.0))) /* Fix angle */
#define PI 3.14159265358979323846
#define TERMINC 100 /* Circle segments for terminator */
#define PROJINT (60 * 10) /* Frequency of seasonal recalculation
in seconds. */
@//E*O*F sunclock.h//
chmod u=rw,g=,o= sunclock.h
echo x - bitmaps.c
sed 's/^@//' > "bitmaps.c" <<'@//E*O*F bitmaps.c//'
/*
* bitmaps for sun clock, X11 version
*/
#define DEFINE_BITS
#include "bitmaps.h"
@//E*O*F bitmaps.c//
chmod u=rw,g=,o= bitmaps.c
echo x - bitmaps.h
sed 's/^@//' > "bitmaps.h" <<'@//E*O*F bitmaps.h//'
/*
* bitmaps for sun clock, X11 version; header file
*/
#ifdef DEFINE_BITS
#define EXTERN
#else
#define EXTERN extern
#endif
#define icon_map_width 126
#define icon_map_height 63
EXTERN char icon_map_bits[]
#ifdef DEFINE_BITS
#include "icon.bits.h"
#else
;
#endif
#define large_map_width 640
#define large_map_height 320
EXTERN char large_map_bits[]
#ifdef DEFINE_BITS
#include "large.bits.h"
#else
;
#endif
@//E*O*F bitmaps.h//
chmod u=rw,g=,o= bitmaps.h
echo x - icon.bits.h
sed 's/^@//' > "icon.bits.h" <<'@//E*O*F icon.bits.h//'
= {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0xff,0xff,0x07,0x00,0x00,0x10,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xff,0x03,0xe0,0x07,0xfe,0xf0,0x3f,0xc0,
0x0f,0x00,0x00,0x00,0x00,0x00,0xf8,0xff,0xff,0x07,0x80,0x01,0x7e,0x00,0x7c,
0xc0,0x3f,0xe0,0x01,0x00,0x00,0x00,0xf8,0xff,0x1f,0x0c,0xe0,0x01,0x00,0x00,
0xff,0x7d,0xfb,0xef,0x07,0x00,0xc1,0x1f,0xfe,0xff,0xff,0x38,0xf0,0x18,0xf0,
0x03,0xef,0x0f,0xa0,0xff,0x7f,0x16,0x73,0xf0,0xff,0xff,0xff,0x3b,0x78,0x00,
0xbc,0xff,0xff,0x03,0x06,0x00,0xe6,0x1f,0x7f,0x00,0xb8,0xfb,0xff,0x33,0xcf,
0x07,0xfe,0x7f,0xc0,0x0f,0x00,0x00,0x00,0x18,0x7c,0x06,0xf0,0xf3,0xff,0xf1,
0xc1,0x83,0xf7,0x1f,0x00,0x00,0x00,0x00,0xe0,0x1c,0xf0,0xff,0xe1,0x67,0xe8,
0xe1,0x00,0xf0,0xff,0x0f,0x00,0x00,0x00,0x80,0xff,0x07,0xc0,0xc3,0x83,0xcd,
0xbd,0x03,0x00,0x70,0xff,0x0b,0x00,0x00,0x06,0xe0,0xf0,0x00,0xf8,0x00,0x07,
0x18,0x2f,0x0e,0x00,0xf8,0x3f,0xc0,0x00,0x03,0x1e,0xe0,0x71,0x00,0x1f,0x00,
0x0f,0xb8,0x8d,0x0f,0x00,0xf8,0x00,0x60,0x00,0x02,0x0c,0x80,0x31,0x00,0x00,
0x00,0x1c,0x8e,0xdf,0x1f,0x00,0x60,0x00,0x28,0x18,0x00,0x00,0xc0,0x19,0x00,
0x00,0x00,0x08,0xc8,0xef,0x1b,0x00,0x40,0x0f,0xcf,0x8d,0x0f,0x00,0xe0,0x0f,
0x00,0x00,0x00,0x08,0x08,0xff,0x01,0x00,0xf8,0x9f,0xde,0x0d,0x03,0x00,0xb8,
0x03,0x00,0x00,0x00,0x08,0x00,0x77,0x00,0x10,0xc8,0xff,0xbd,0x03,0x00,0x80,
0xcf,0x00,0x00,0x00,0x00,0x18,0x00,0x10,0x00,0x70,0xf8,0xef,0xb7,0x01,0x00,
0x80,0xef,0x00,0x00,0x00,0x00,0x70,0x00,0x1c,0x00,0x00,0x78,0xc7,0x04,0x00,
0x00,0x80,0xfd,0x00,0x00,0x00,0x00,0xc0,0x80,0x07,0x00,0x00,0x0b,0xfc,0xc7,
0x00,0x00,0x80,0x19,0x00,0x00,0x00,0x00,0xc0,0xf1,0x06,0x00,0x00,0x0e,0x00,
0xc6,0x03,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0xc0,0x13,0x0c,0x00,0x00,0x06,
0x00,0x8e,0x3f,0x00,0x80,0x01,0x00,0x00,0x80,0x00,0x00,0x17,0x0f,0x00,0x00,
0x03,0x00,0x0f,0xe7,0x70,0xf8,0x01,0x00,0x00,0x80,0x01,0x00,0xf4,0xff,0x00,
0x00,0x03,0x00,0x1c,0xc6,0xd8,0x18,0x01,0x00,0x00,0x00,0x00,0x00,0xfc,0xfb,
0x01,0x00,0x02,0x00,0x18,0x83,0x8c,0x99,0x01,0x00,0x00,0x00,0x00,0x00,0xe0,
0x03,0x00,0x00,0x03,0x0c,0xf8,0x81,0xc5,0x9b,0x03,0x00,0x00,0x00,0x00,0x00,
0x01,0xf3,0x03,0x00,0x06,0x0c,0xe0,0x00,0x47,0x9f,0x03,0x40,0x02,0x00,0x00,
0x00,0x01,0xff,0x07,0x00,0x44,0x00,0x80,0x00,0x47,0x8f,0x07,0x40,0x02,0x00,
0x00,0x00,0x00,0x0c,0x1c,0x00,0xfc,0x03,0xc4,0x00,0xc6,0xef,0x06,0x00,0x00,
0x00,0x00,0x00,0x00,0x08,0x30,0x00,0x00,0x03,0x67,0x00,0x80,0xff,0x0e,0x00,
0x00,0x00,0x00,0x00,0xc0,0x0c,0xf0,0x00,0x00,0x13,0x37,0x00,0x80,0xd7,0x5f,
0x00,0x08,0x00,0x00,0x00,0x40,0x0c,0xb0,0x03,0x00,0x12,0x1b,0x00,0x00,0xff,
0xff,0x0d,0x08,0x00,0x00,0x00,0x00,0x04,0x00,0x06,0x00,0x06,0x09,0x00,0x00,
0xfe,0x61,0x1f,0x00,0x00,0x40,0x00,0x00,0x0c,0x00,0x04,0x06,0x84,0x09,0x00,
0x00,0xf8,0xc7,0x77,0x00,0x00,0x40,0x00,0x00,0x18,0x00,0x06,0x00,0x04,0xb9,
0x00,0x00,0x80,0xbb,0x07,0x00,0x00,0x00,0x00,0x00,0x50,0x00,0x02,0x00,0x04,
0xf3,0x00,0x00,0x00,0xae,0x01,0x01,0x00,0x20,0x00,0x00,0x70,0x00,0x02,0x30,
0xcc,0xff,0x00,0x00,0x00,0xe3,0x03,0x03,0x00,0x20,0x00,0x00,0x40,0x00,0x03,
0x00,0x4c,0xe4,0x02,0x00,0xc0,0x01,0x86,0x03,0x00,0x00,0x00,0x00,0x40,0xc0,
0x01,0x00,0x0c,0x64,0x02,0x00,0x60,0x00,0x0c,0x01,0x00,0x00,0x00,0x00,0x40,
0x60,0x00,0x00,0x08,0x66,0x00,0x00,0x60,0x00,0x08,0x00,0x00,0x00,0x00,0x00,
0x60,0x60,0x00,0x00,0x18,0x03,0x00,0x00,0xe0,0xe1,0x08,0x00,0x00,0x00,0x00,
0x00,0x20,0x30,0x00,0x00,0x90,0x01,0x00,0x00,0xc0,0xfe,0x08,0x00,0x00,0x00,
0x00,0x00,0x20,0x1c,0x00,0x00,0xf0,0x00,0x00,0x00,0xc0,0x63,0x0c,0x0c,0x00,
0x00,0x00,0x00,0x20,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x07,0x1c,
0x00,0x00,0x00,0x00,0x20,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0x1c,0x00,0x00,0x00,0x00,0x30,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x03,0x0f,0x00,0x00,0x00,0x00,0xb0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x07,0x00,0x00,0x00,0x00,0xb0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0xf0,0x06,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x01,0x06,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x03,
0x00,0x00,0x00,0x00,0x1f,0xfc,0xff,0xff,0x01,0x00,0x00,0x00,0x00,0x00,0xf8,
0x03,0x00,0x00,0x08,0xff,0xe1,0x07,0x00,0x00,0x7f,0x00,0x00,0x00,0x00,0xf8,
0xfb,0x02,0x00,0xf8,0xff,0x01,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0xe0,0xff,
0x3f,0x7f,0x03,0xc0,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x03,0x80,0x3f,
0x06,0x00,0x80,0x1f,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01,0x60,
0x0f,0x00,0x00,0x00,0xe0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x01,
0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,
0x1f,0x07,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00};
@//E*O*F icon.bits.h//
chmod u=rw,g=,o= icon.bits.h
echo x - large.bits.h
sed 's/^@//' > "l.b.h.Z.uu" <<'@//E*O*F l.b.h.Z.uu//'
begin 600 l.b.h.Z
M'YV0/4#L40`"!AX8,%@81*CP8,*%#QTV9`AQ8D2*$BMJS,B1(<&-&$->'&FQ
M)$B2)TU*_- at 194N5(F&ZC)F2)<V7*7/BW'G38T&>,X/*'*HSIDVA19$")?KR
M*-.>2J$^)>DTZ=2K5FO^E)IU:5>I5;V*Y3J6ZM:H:+&6+1F6K-NT7Q.VA;LV
M[M"Y:M_F%8K7KM^Z*\_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?,X+[Y56`S%66VFN6_]6#L%N5 at C
MZHC$1S]S&@)V#.?>_,MI')3U,)I\R,M:3;M;2<P;\>P'>IZ^HU#GN$^3]B#M
MI(:6I!E4_^>^U9X3H+4@&'6C6$P\<[7'R`K$N-1+:XXT:"?=JC6=RHK*F&_M
M>!^;T/9X)"$6L!*Z(_1JR=RA9W1;3DW<-$2=1Q^SHNN72I,;:,T/:^M4/1;O
M,M!4JAH#N-29)8CS_*.U#2,(FD-,SM%\LC?V7^/#3C*IK%%A%S+GZS2--'29
M4:/G5+QGI"V_:<N&M]YEY81MGA^T%=:JF-;2M)`6O:7[R,(.Q4JZ+!OM->VM
MQ6\`7M02!7GA:@-7'77RU&:/=7:+OLN6G:LI,=*^.4 at X6Y?M5O&TZ]K004W[
M.FU'*O(ZM)TUQ[9OJ64;3K<;':G98`T))X":$=]M4O>OIQ51$K?INF'K['5M
MG]T"S^82^J,0!>JU/;@%-VY:R+O$N*5D#CVA*S>W'LX'N^>F8Y;MJSOWXB[2
MFD$B?Z7'W:X9M]J>W'L9>E5K.>V=7[?E;MR4VR:W"&UGMT^WR\;=1+:&;JM_
M++=1-_"^W=*-K!0A.U)AV_9^AMW(VW7_9ZN!-K2V1$+516X+$>V>[+LI=_?V
M01W(5!9NQ7V\/[>N!GLV.VICYO,-O<WWUW;?(#IZ&V_;#;\]=[^FW_=;>L]O
M_?V[\;>ZWM\`O'_S;^]=OO-W`"?@_IM\)W#37<#_MP`_X.W;@#_P"0XN^L`.
"4`"[
`
end
@//E*O*F l.b.h.Z.uu//
chmod u=rw,g=,o= l.b.h.Z.uu
uudecode <l.b.h.Z.uu
uncompress <l.b.h.Z >large.bits.h
rm -f l.b.h.*
echo x - astro.c
sed 's/^@//' > "astro.c" <<'@//E*O*F astro.c//'
/*
* Sun clock - astronomical routines.
*/
#include "sunclock.h"
/* JDATE -- Convert internal GMT date and time to Julian day
and fraction. */
long
jdate(t)
struct tm *t;
{
long c, m, y;
y = t->tm_year + 1900;
m = t->tm_mon + 1;
if (m > 2)
m = m - 3;
else {
m = m + 9;
y--;
}
c = y / 100L; /* Compute century */
y -= 100L * c;
return t->tm_mday + (c * 146097L) / 4 + (y * 1461L) / 4 +
(m * 153L + 2) / 5 + 1721119L;
}
/* JTIME -- Convert internal GMT date and time to astronomical
Julian time (i.e. Julian date plus day fraction,
expressed as a double). */
double
jtime(t)
struct tm *t;
{
return (jdate(t) - 0.5) +
(((long) t->tm_sec) +
60L * (t->tm_min + 60L * t->tm_hour)) / 86400.0;
}
/* KEPLER -- Solve the equation of Kepler. */
double
kepler(m, ecc)
double m, ecc;
{
double e, delta;
#define EPSILON 1E-6
e = m = dtr(m);
do {
delta = e - ecc * sin(e) - m;
e -= delta / (1 - ecc * cos(e));
} while (abs(delta) > EPSILON);
return e;
}
/* SUNPOS -- Calculate position of the Sun. JD is the Julian date
of the instant for which the position is desired and
APPARENT should be nonzero if the apparent position
(corrected for nutation and aberration) is desired.
The Sun's co-ordinates are returned in RA and DEC,
both specified in degrees (divide RA by 15 to obtain
hours). The radius vector to the Sun in astronomical
units is returned in RV and the Sun's longitude (true
or apparent, as desired) is returned as degrees in
SLONG. */
sunpos(jd, apparent, ra, dec, rv, slong)
double jd;
int apparent;
double *ra, *dec, *rv, *slong;
{
double t, t2, t3, l, m, e, ea, v, theta, omega,
eps;
/* Time, in Julian centuries of 36525 ephemeris days,
measured from the epoch 1900 January 0.5 ET. */
t = (jd - 2415020.0) / 36525.0;
t2 = t * t;
t3 = t2 * t;
/* Geometric mean longitude of the Sun, referred to the
mean equinox of the date. */
l = fixangle(279.69668 + 36000.76892 * t + 0.0003025 * t2);
/* Sun's mean anomaly. */
m = fixangle(358.47583 + 35999.04975*t - 0.000150*t2 - 0.0000033*t3);
/* Eccentricity of the Earth's orbit. */
e = 0.01675104 - 0.0000418 * t - 0.000000126 * t2;
/* Eccentric anomaly. */
ea = kepler(m, e);
/* True anomaly */
v = fixangle(2 * rtd(atan(sqrt((1 + e) / (1 - e)) * tan(ea / 2))));
/* Sun's true longitude. */
theta = l + v - m;
/* Obliquity of the ecliptic. */
eps = 23.452294 - 0.0130125 * t - 0.00000164 * t2 + 0.000000503 * t3;
/* Corrections for Sun's apparent longitude, if desired. */
if (apparent) {
omega = fixangle(259.18 - 1934.142 * t);
theta = theta - 0.00569 - 0.00479 * sin(dtr(omega));
eps += 0.00256 * cos(dtr(omega));
}
/* Return Sun's longitude and radius vector */
*slong = theta;
*rv = (1.0000002 * (1 - e * e)) / (1 + e * cos(dtr(v)));
/* Determine solar co-ordinates. */
*ra =
fixangle(rtd(atan2(cos(dtr(eps)) * sin(dtr(theta)), cos(dtr(theta)))));
*dec = rtd(asin(sin(dtr(eps)) * sin(dtr(theta))));
}
/* GMST -- Calculate Greenwich Mean Siderial Time for a given
instant expressed as a Julian date and fraction. */
double
gmst(jd)
double jd;
{
double t, theta0;
/* Time, in Julian centuries of 36525 ephemeris days,
measured from the epoch 1900 January 0.5 ET. */
t = ((floor(jd + 0.5) - 0.5) - 2415020.0) / 36525.0;
theta0 = 6.6460656 + 2400.051262 * t + 0.00002581 * t * t;
t = (jd + 0.5) - (floor(jd + 0.5));
theta0 += (t * 24.0) * 1.002737908;
theta0 = (theta0 - 24.0 * (floor(theta0 / 24.0)));
return theta0;
}
@//E*O*F astro.c//
chmod u=rw,g=,o= astro.c
echo x - sunclock.c
sed 's/^@//' > "sunclock.c" <<'@//E*O*F sunclock.c//'
/*
* Sun clock. X11 version by John Mackin.
*
* This program was derived from, and is still in part identical with, the
* Suntools Sun clock program whose author's comment appears immediately
* below. Please preserve both notices.
*
* The X11R3/4 version of this program was written by John Mackin, at the
* Basser Department of Computer Science, University of Sydney, Sydney,
* New South Wales, Australia; <john at cs.su.oz.AU>. This program, like
* the one it was derived from, is in the public domain: `Love is the
* law, love under will.'
*/
/*
Sun clock
Designed and implemented by John Walker in November of 1988.
Version for the Sun Workstation.
The algorithm used to calculate the position of the Sun is given in
Chapter 18 of:
"Astronomical Formulae for Calculators" by Jean Meeus, Third Edition,
Richmond: Willmann-Bell, 1985. This book can be obtained from:
Willmann-Bell
P.O. Box 35025
Richmond, VA 23235
USA
Phone: (804) 320-7016
This program was written by:
John Walker
Autodesk, Inc.
2320 Marinship Way
Sausalito, CA 94965
USA
Fax: (415) 389-9418
Voice: (415) 332-2344 Ext. 2829
Usenet: {sun,well,uunet}!acad!kelvin
or: kelvin at acad.uu.net
This program is in the public domain: "Do what thou wilt shall be the
whole of the law". I'd appreciate receiving any bug fixes and/or
enhancements, which I'll incorporate in future versions of the
program. Please leave the original attribution information intact so
that credit and blame may be properly apportioned.
Revision history:
1.0 12/21/89 Initial version.
8/24/89 Finally got around to submitting.
*/
#define FAILFONT "fixed"
#define VERSION "1.0"
#include "sunclock.h"
struct sunclock {
int s_width; /* size of pixmap */
int s_height;
Window s_window; /* associated window */
Pixmap s_pixmap; /* and pixmap */
int s_flags; /* see below */
int s_noon; /* position of noon */
short * s_wtab1; /* current width table (?) */
short * s_wtab; /* previous width table (?) */
long s_increm; /* increment for fake time */
long s_time; /* time - real or fake, see flags */
GC s_gc; /* GC for writing text into window */
char * (*s_tfunc)(); /* function to return the text */
char s_text[80]; /* and the current text that's there */
int s_textx; /* where to draw the text */
int s_texty; /* where to draw the text */
long s_projtime; /* last time we projected illumination */
int s_timeout; /* time until next image update */
struct sunclock * s_next; /* pointer to next clock context */
};
/*
* bits in s_flags
*/
#define S_FAKE 01 /* date is fake, don't use actual time */
#define S_ANIMATE 02 /* do animation based on increment */
#define S_DIRTY 04 /* pixmap -> window copy required */
#define S_ICON 010 /* this is the icon window */
char * strrchr();
long time();
double jtime();
double gmst();
char * salloc();
char * bigtprint();
char * smalltprint();
struct sunclock * makeClockContext();
Bool evpred();
char * Wdayname[] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
char * Monname[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
"Aug", "Sep", "Oct", "Nov", "Dec"
};
struct geom {
int mask;
int x;
int y;
};
char * Name;
char * Display_name = "";
Display * dpy;
int scr;
unsigned long Black;
unsigned long White;
GC GC_store;
GC GC_invert;
GC GC_bigf;
GC GC_smallf;
XFontStruct * SmallFont;
XFontStruct * BigFont;
Pixmap Mappix;
Pixmap Iconpix;
Window Icon;
Window Clock;
struct sunclock * Current;
int Iconic = 0;
struct geom Geom = { 0, 0, 0 };
struct geom Icongeom = { 0, 0, 0 };
main(argc, argv)
int argc;
register char ** argv;
{
char * p;
Name = *argv;
if (p = strrchr(Name, '/'))
Name = ++p;
parseArgs(argc, argv);
dpy = XOpenDisplay(Display_name);
if (dpy == (Display *)NULL) {
fprintf(stderr, "%s: can't open display `%s'\n", Display_name);
exit(1);
}
scr = DefaultScreen(dpy);
getColors();
getFonts();
makePixmaps();
makeWindows();
makeGCs(Clock, Mappix);
setAllHints(argc, argv);
makeClockContexts();
XSelectInput(dpy, Clock, ExposureMask);
XSelectInput(dpy, Icon, ExposureMask);
XMapWindow(dpy, Clock);
eventLoop();
/*
* eventLoop() never returns, but one day it might, if someone adds a
* menu for animation or such with a "quit" option.
*/
shutDown();
exit(0);
}
parseArgs(argc, argv)
register int argc;
register char ** argv;
{
while (--argc > 0) {
++argv;
if (strcmp(*argv, "-display") == 0) {
needMore(argc, argv);
Display_name = *++argv;
--argc;
}
else if (strcmp(*argv, "-iconic") == 0)
Iconic++;
else if (strcmp(*argv, "-geometry") == 0) {
needMore(argc, argv);
getGeom(*++argv, &Geom);
--argc;
}
else if (strcmp(*argv, "-icongeometry") == 0) {
needMore(argc, argv);
getGeom(*++argv, &Icongeom);
--argc;
}
else if (strcmp(*argv, "-version") == 0) {
fprintf(stderr, "%s: version %s patchlevel %d\n",
Name, VERSION, PATCHLEVEL);
exit(0);
}
else
usage();
}
}
needMore(argc, argv)
register int argc;
register char ** argv;
{
if (argc == 1) {
fprintf(stderr, "%s: option `%s' requires an argument\n",
Name, *argv);
usage();
}
}
getGeom(s, g)
register char * s;
register struct geom * g;
{
register int mask;
unsigned int width;
unsigned int height;
mask = XParseGeometry(s, &g->x, &g->y, &width, &height);
if (mask == 0) {
fprintf(stderr, "%s: `%s' is a bad geometry specification\n",
Name, s);
exit(1);
}
if ((mask & WidthValue) || (mask & HeightValue))
fprintf(stderr, "%s: warning: width/height in geometry `%s' ignored\n",
Name, s);
g->mask = mask;
}
/*
* Free resources.
*/
shutDown()
{
XFreeGC(dpy, GC_store);
XFreeGC(dpy, GC_invert);
XFreeGC(dpy, GC_bigf);
XFreeGC(dpy, GC_smallf);
XFreeFont(dpy, BigFont);
XFreeFont(dpy, SmallFont);
XFreePixmap(dpy, Mappix);
XFreePixmap(dpy, Iconpix);
XDestroyWindow(dpy, Clock);
XDestroyWindow(dpy, Icon);
XCloseDisplay(dpy);
}
usage()
{
fprintf(stderr,
"usage: %s [-display dispname] [-geometry +x+y] [-icongeometry +x+y] [-iconic] [-version]\n",
Name);
exit(1);
}
/*
* Set up stuff the window manager will want to know. Must be done
* before mapping window, but after creating it.
*/
setAllHints(argc, argv)
int argc;
char ** argv;
{
XClassHint xch;
XSizeHints xsh;
XWMHints xwmh;
xch.res_name = Name;
xch.res_class = "Sunclock";
XSetClassHint(dpy, Clock, &xch);
XStoreName(dpy, Clock, Name);
XSetCommand(dpy, Clock, argv, argc);
XSetIconName(dpy, Clock, Name);
xsh.flags = PSize | PMinSize | PMaxSize;
if (Geom.mask & (XValue | YValue)) {
xsh.x = Geom.x;
xsh.y = Geom.y;
xsh.flags |= USPosition;
}
xsh.width = xsh.min_width = xsh.max_width = large_map_width;
xsh.height = xsh.min_height = xsh.max_height = large_map_height;
XSetNormalHints(dpy, Clock, &xsh);
xwmh.flags = InputHint | StateHint | IconWindowHint;
if (Icongeom.mask & (XValue | YValue)) {
xwmh.icon_x = Icongeom.x;
xwmh.icon_y = Icongeom.y;
xwmh.flags |= IconPositionHint;
}
xwmh.input = False;
xwmh.initial_state = Iconic ? IconicState : NormalState;
xwmh.icon_window = Icon;
XSetWMHints(dpy, Clock, &xwmh);
}
makeWindows()
{
register int ht;
XSetWindowAttributes xswa;
register int mask;
ht = icon_map_height + SmallFont->max_bounds.ascent +
SmallFont->max_bounds.descent + 2;
xswa.background_pixel = White;
xswa.border_pixel = Black;
xswa.backing_store = WhenMapped;
mask = CWBackPixel | CWBorderPixel | CWBackingStore;
fixGeometry(&Geom, large_map_width, large_map_height);
Clock = XCreateWindow(dpy, RootWindow(dpy, scr), Geom.x, Geom.y,
large_map_width, large_map_height, 3, CopyFromParent,
InputOutput, CopyFromParent, mask, &xswa);
fixGeometry(&Icongeom, icon_map_width, ht);
Icon = XCreateWindow(dpy, RootWindow(dpy, scr), Icongeom.x, Icongeom.y,
icon_map_width, ht, 1, CopyFromParent, InputOutput,
CopyFromParent, mask, &xswa);
}
fixGeometry(g, w, h)
register struct geom * g;
register int w;
register int h;
{
if (g->mask & XNegative)
g->x = DisplayWidth(dpy, scr) - w + g->x;
if (g->mask & YNegative)
g->y = DisplayHeight(dpy, scr) - h + g->y;
}
makeGCs(w, p)
register Window w;
register Pixmap p;
{
XGCValues gcv;
gcv.foreground = Black;
gcv.background = White;
GC_store = XCreateGC(dpy, w, GCForeground | GCBackground, &gcv);
gcv.function = GXinvert;
GC_invert = XCreateGC(dpy, p, GCForeground | GCBackground | GCFunction, &gcv);
gcv.font = BigFont->fid;
GC_bigf = XCreateGC(dpy, w, GCForeground | GCBackground | GCFont, &gcv);
gcv.font = SmallFont->fid;
GC_smallf = XCreateGC(dpy, w, GCForeground | GCBackground | GCFont, &gcv);
}
getColors()
{
XColor c;
XColor e;
register Status s;
s = XAllocNamedColor(dpy, DefaultColormap(dpy, scr), "Black", &c, &e);
if (s != (Status)1) {
fprintf(stderr, "%s: warning: can't allocate color `Black'\n");
Black = BlackPixel(dpy, scr);
}
else
Black = c.pixel;
s = XAllocNamedColor(dpy, DefaultColormap(dpy, scr), "White", &c, &e);
if (s != (Status)1) {
fprintf(stderr, "%s: can't allocate color `White'\n");
White = WhitePixel(dpy, scr);
}
else
White = c.pixel;
}
getFonts()
{
BigFont = XLoadQueryFont(dpy, BIGFONT);
if (BigFont == (XFontStruct *)NULL) {
fprintf(stderr, "%s: can't open font `%s', using `%s'\n",
Name, BIGFONT, FAILFONT);
BigFont = XLoadQueryFont(dpy, FAILFONT);
if (BigFont == (XFontStruct *)NULL) {
fprintf(stderr, "%s: can't open font `%s', giving up\n",
Name, FAILFONT);
exit(1);
}
}
SmallFont = XLoadQueryFont(dpy, SMALLFONT);
if (SmallFont == (XFontStruct *)NULL) {
fprintf(stderr, "%s: can't open font `%s', using `%s'\n",
Name, SMALLFONT, FAILFONT);
SmallFont = XLoadQueryFont(dpy, FAILFONT);
if (SmallFont == (XFontStruct *)NULL) {
fprintf(stderr, "%s: can't open font `%s', giving up\n",
Name, FAILFONT);
exit(1);
}
}
}
makePixmaps()
{
Mappix = XCreatePixmapFromBitmapData(dpy, RootWindow(dpy, scr),
large_map_bits, large_map_width,
large_map_height, 0, 1, 1);
Iconpix = XCreatePixmapFromBitmapData(dpy, RootWindow(dpy, scr),
icon_map_bits, icon_map_width,
icon_map_height, 0, 1, 1);
}
makeClockContexts()
{
register struct sunclock * s;
s = makeClockContext(large_map_width, large_map_height, Clock, Mappix,
GC_bigf, bigtprint, 70,
large_map_height - BigFont->max_bounds.descent - 1);
Current = s;
s = makeClockContext(icon_map_width, icon_map_height, Icon, Iconpix,
GC_smallf, smalltprint, 6,
icon_map_height + SmallFont->max_bounds.ascent + 1);
Current->s_next = s;
s->s_flags |= S_ICON;
s->s_next = Current;
}
struct sunclock *
makeClockContext(wid, ht, win, pix, gc, fun, txx, txy)
int wid;
int ht;
Window win;
Pixmap pix;
GC gc;
char * (*fun)();
int txx;
int txy;
{
register struct sunclock * s;
s = (struct sunclock *)salloc(sizeof (struct sunclock));
s->s_width = wid;
s->s_height = ht;
s->s_window = win;
s->s_pixmap = pix;
s->s_flags = S_DIRTY;
s->s_noon = -1;
s->s_wtab = (short *)salloc((int)(ht * sizeof (short *)));
s->s_wtab1 = (short *)salloc((int)(ht * sizeof (short *)));
s->s_increm = 0L;
s->s_time = 0L;
s->s_gc = gc;
s->s_tfunc = fun;
s->s_timeout = 0;
s->s_projtime = -1L;
s->s_text[0] = '\0';
s->s_textx = txx;
s->s_texty = txy;
return (s);
}
/*
* Someone is sure to wonder why the event loop is coded this way, without
* using select(). The answer is that this was developed on a System V
* kernel, which has select() but the call has bugs; so, I was inspired
* to make it portable to systems without select(). The slight delay in
* expose event processing that results from using sleep(1) rather than
* alarm() is a fine payoff for not having to worry about interrupted
* system calls.
*
* I've got to use XCheckIfEvent with a degenerate predicate rather than
* XCheckMaskEvent with a mask of -1L because the latter won't collect all
* types of events, notably ClientMessage and Selection events. Sigh.
*/
eventLoop()
{
XEvent ev;
for (;;) {
if (XCheckIfEvent(dpy, &ev, evpred, (char *)0))
switch (ev.type) {
case Expose:
if (ev.xexpose.count == 0)
doExpose(ev.xexpose.window);
break;
}
else {
sleep(1);
doTimeout();
}
}
}
Bool
evpred(d, e, a)
register Display * d;
register XEvent * e;
register char * a;
{
return (True);
}
/*
* Got an expose event for window w. Do the right thing if it's not
* currently the one we're displaying.
*/
doExpose(w)
register Window w;
{
if (w != Current->s_window) {
Current = Current->s_next;
if (w != Current->s_window) {
fprintf(stderr,
"%s: expose event for unknown window, id = 0x%08lx\n",
w);
exit(1);
}
setTimeout(Current);
}
updimage(Current);
Current->s_flags |= S_DIRTY;
showImage(Current);
}
doTimeout()
{
if (QLength(dpy))
return; /* ensure events processed first */
if (--Current->s_timeout <= 0) {
updimage(Current);
showImage(Current);
setTimeout(Current);
}
}
setTimeout(s)
register struct sunclock * s;
{
long t;
if (s->s_flags & S_ICON) {
time(&t);
s->s_timeout = 60 - localtime(&t)->tm_sec;
}
else
s->s_timeout = 1;
}
showImage(s)
register struct sunclock * s;
{
register char * p;
struct tm lt;
register struct tm * gmtp;
lt = *localtime(&s->s_time);
gmtp = gmtime(&s->s_time);
p = (*s->s_tfunc)(<, gmtp);
if (s->s_flags & S_DIRTY) {
XCopyPlane(dpy, s->s_pixmap, s->s_window, GC_store, 0, 0,
s->s_width, s->s_height, 0, 0, 1);
if (s->s_flags & S_ICON)
XClearArea(dpy, s->s_window, 0, s->s_height + 1,
0, 0, False);
s->s_flags &= ~S_DIRTY;
}
strcpy(s->s_text, p);
showText(s);
}
showText(s)
register struct sunclock * s;
{
XDrawImageString(dpy, s->s_window, s->s_gc, s->s_textx,
s->s_texty, s->s_text, strlen(s->s_text));
}
/* --- */
/* UPDIMAGE -- Update current displayed image. */
updimage(s)
register struct sunclock * s;
{
register int i;
int xl;
struct tm * ct;
double jt;
double sunra;
double sundec;
double sunrv;
double sunlong;
double gt;
struct tm lt;
short * wtab_swap;
/* If this is a full repaint of the window, force complete
recalculation. */
if (s->s_noon < 0) {
s->s_projtime = 0;
for (i = 0; i < s->s_height; i++) {
s->s_wtab1[i] = -1;
}
}
if (s->s_flags & S_FAKE) {
if (s->s_flags & S_ANIMATE)
s->s_time += s->s_increm;
if (s->s_time < 0)
s->s_time = 0;
} else
time(&s->s_time);
lt = *localtime(&s->s_time);
ct = gmtime(&s->s_time);
jt = jtime(ct);
sunpos(jt, False, &sunra, &sundec, &sunrv, &sunlong);
gt = gmst(jt);
/* Projecting the illumination curve for the current seasonal
instant is costly. If we're running in real time, only do
it every PROJINT seconds. */
if ((s->s_flags & S_FAKE)
|| s->s_projtime < 0
|| (s->s_time - s->s_projtime) > PROJINT) {
projillum(s->s_wtab, s->s_width, s->s_height, sundec);
wtab_swap = s->s_wtab;
s->s_wtab = s->s_wtab1;
s->s_wtab1 = wtab_swap;
s->s_projtime = s->s_time;
}
sunlong = fixangle(180.0 + (sunra - (gt * 15)));
xl = sunlong * (s->s_width / 360.0);
/* If the subsolar point has moved at least one pixel, update
the illuminated area on the screen. */
if ((s->s_flags & S_FAKE) || s->s_noon != xl) {
moveterm(s->s_wtab1, xl, s->s_wtab, s->s_noon, s->s_width,
s->s_height, s->s_pixmap);
s->s_noon = xl;
s->s_flags |= S_DIRTY;
}
}
/* PROJILLUM -- Project illuminated area on the map. */
projillum(wtab, xdots, ydots, dec)
short *wtab;
int xdots, ydots;
double dec;
{
int i, ftf = True, ilon, ilat, lilon, lilat, xt;
double m, x, y, z, th, lon, lat, s, c;
/* Clear unoccupied cells in width table */
for (i = 0; i < ydots; i++)
wtab[i] = -1;
/* Build transformation for declination */
s = sin(-dtr(dec));
c = cos(-dtr(dec));
/* Increment over a semicircle of illumination */
for (th = -(PI / 2); th <= PI / 2 + 0.001;
th += PI / TERMINC) {
/* Transform the point through the declination rotation. */
x = -s * sin(th);
y = cos(th);
z = c * sin(th);
/* Transform the resulting co-ordinate through the
map projection to obtain screen co-ordinates. */
lon = (y == 0 && x == 0) ? 0.0 : rtd(atan2(y, x));
lat = rtd(asin(z));
ilat = ydots - (lat + 90) * (ydots / 180.0);
ilon = lon * (xdots / 360.0);
if (ftf) {
/* First time. Just save start co-ordinate. */
lilon = ilon;
lilat = ilat;
ftf = False;
} else {
/* Trace out the line and set the width table. */
if (lilat == ilat) {
wtab[(ydots - 1) - ilat] = ilon == 0 ? 1 : ilon;
} else {
m = ((double) (ilon - lilon)) / (ilat - lilat);
for (i = lilat; i != ilat; i += sgn(ilat - lilat)) {
xt = lilon + floor((m * (i - lilat)) + 0.5);
wtab[(ydots - 1) - i] = xt == 0 ? 1 : xt;
}
}
lilon = ilon;
lilat = ilat;
}
}
/* Now tweak the widths to generate full illumination for
the correct pole. */
if (dec < 0.0) {
ilat = ydots - 1;
lilat = -1;
} else {
ilat = 0;
lilat = 1;
}
for (i = ilat; i != ydots / 2; i += lilat) {
if (wtab[i] != -1) {
while (True) {
wtab[i] = xdots / 2;
if (i == ilat)
break;
i -= lilat;
}
break;
}
}
}
/* XSPAN -- Complement a span of pixels. Called with line in which
pixels are contained, leftmost pixel in the line, and
the number of pixels to complement. Handles
wrap-around at the right edge of the screen. */
xspan(pline, leftp, npix, xdots, p)
register int pline;
register int leftp;
register int npix;
register int xdots;
register Pixmap p;
{
leftp = leftp % xdots;
if (leftp + npix > xdots) {
XDrawLine(dpy, p, GC_invert, leftp, pline, xdots - 1, pline);
XDrawLine(dpy, p, GC_invert, 0, pline,
(leftp + npix) - (xdots + 1), pline);
}
else
XDrawLine(dpy, p, GC_invert, leftp, pline,
leftp + (npix - 1), pline);
}
/* MOVETERM -- Update illuminated portion of the globe. */
moveterm(wtab, noon, otab, onoon, xdots, ydots, pixmap)
short *wtab, *otab;
int noon, onoon, xdots, ydots;
Pixmap pixmap;
{
int i, ol, oh, nl, nh;
for (i = 0; i < ydots; i++) {
/* If line is off in new width table but is set in
the old table, clear it. */
if (wtab[i] < 0) {
if (otab[i] >= 0) {
xspan(i, ((onoon - otab[i]) + xdots) % xdots,
otab[i] * 2, xdots, pixmap);
}
} else {
/* Line is on in new width table. If it was off in
the old width table, just draw it. */
if (otab[i] < 0) {
xspan(i, ((noon - wtab[i]) + xdots) % xdots,
wtab[i] * 2, xdots, pixmap);
} else {
/* If both the old and new spans were the entire
screen, they're equivalent. */
if (otab[i] == wtab[i] && wtab[i] == (xdots / 2))
continue;
/* The line was on in both the old and new width
tables. We must adjust the difference in the
span. */
ol = ((onoon - otab[i]) + xdots) % xdots;
oh = (ol + otab[i] * 2) - 1;
nl = ((noon - wtab[i]) + xdots) % xdots;
nh = (nl + wtab[i] * 2) - 1;
/* If spans are disjoint, erase old span and set
new span. */
if (oh < nl || nh < ol) {
xspan(i, ol, (oh - ol) + 1, xdots, pixmap);
xspan(i, nl, (nh - nl) + 1, xdots, pixmap);
} else {
/* Clear portion(s) of old span that extend
beyond end of new span. */
if (ol < nl) {
xspan(i, ol, nl - ol, xdots, pixmap);
ol = nl;
}
if (oh > nh) {
xspan(i, nh + 1, oh - nh, xdots, pixmap);
oh = nh;
}
/* Extend existing (possibly trimmed) span to
correct new length. */
if (nl < ol) {
xspan(i, nl, ol - nl, xdots, pixmap);
}
if (nh > oh) {
xspan(i, oh + 1, nh - oh, xdots, pixmap);
}
}
}
}
otab[i] = wtab[i];
}
}
char *
salloc(nbytes)
register int nbytes;
{
register char * p;
char * malloc();
p = malloc((unsigned)nbytes);
if (p == (char *)NULL) {
fprintf(stderr, "%s: out of memory\n");
exit(1);
}
return (p);
}
char *
bigtprint(ltp, gmtp)
register struct tm * ltp;
register struct tm * gmtp;
{
static char s[80];
sprintf(s,
"%02d:%02d:%02d %s %s %02d %s %02d %02d:%02d:%02d UTC %s %02d %s %02d",
ltp->tm_hour, ltp->tm_min,
ltp->tm_sec,
#ifdef NEW_CTIME
ltp->tm_zone,
#else
tzname[ltp->tm_isdst],
#endif
Wdayname[ltp->tm_wday], ltp->tm_mday,
Monname[ltp->tm_mon], ltp->tm_year % 100,
gmtp->tm_hour, gmtp->tm_min,
gmtp->tm_sec, Wdayname[gmtp->tm_wday], gmtp->tm_mday,
Monname[gmtp->tm_mon], gmtp->tm_year % 100);
return (s);
}
char *
smalltprint(ltp, gmtp)
register struct tm * ltp;
register struct tm * gmtp;
{
static char s[80];
sprintf(s, "%02d:%02d %s %02d %s %02d", ltp->tm_hour, ltp->tm_min,
Wdayname[ltp->tm_wday], ltp->tm_mday, Monname[ltp->tm_mon],
ltp->tm_year % 100);
return (s);
}
@//E*O*F sunclock.c//
chmod u=rw,g=,o= sunclock.c
echo x - patchlevel.h
sed 's/^@//' > "patchlevel.h" <<'@//E*O*F patchlevel.h//'
/*
* Track patch level of sunclock.
*/
#define PATCHLEVEL 0
@//E*O*F patchlevel.h//
chmod u=rw,g=,o= patchlevel.h
exit 0
dan
----------------------------------------------------
O'Reilly && Associates argv at sun.com / argv at ora.com
Opinions expressed reflect those of the author only.
More information about the Comp.sources.x
mailing list