WWW Digital Clock!
Latest Release 1.2 (August 20, 1995)
Initial Release 1.1 (August 16, 1995)
Access since August 19:
and the local time is:
The source code of 1.2 is avalable as a gzip'd tar file at:
ftp.semcor.com
-Please limit your ftp session to after business hours-
This program is compiled and tested on a Sparc 10 (SunOS 4.1.4), gcc 2.6.3,
NCSA httpd 1.4 , CERN httpd 3.0 and Netscape 1.1N for Unix. If you use it
in a different OS, please let me know.
This program is developed in my own time. My employer
SEMCOR, Inc. has nothing to do with it.
- How to use it
- The file dgclock-1.2.tar.gz is a gzip'd tar file. To extract the
distribution, at the shell prompt, type:
gunzip < dgclock-1.2.tar.gz | tar xvf -
cd dgclock1.2
- Edit the file config.h, change following the directives:
- DigitDir
- This directive defines the directory where all the necessary digit
images are kept. If you are using my
Counter program, make sure that you do
not specify the same digit directory. The digits used by this program are
supplied with the source distribution in the clkdigitdir directory.
Providing the correct path of the digit directory with the directive
DigitDir is a must. Make sure that the digit directory is
accessible and digit images are readable by httpd.
- ErrorLog
- This directive defines the full path of the error log file. The error
messages will be written to this file. If the program fails to open this file,
the error messages will be written to stderr. Make sure that httpd has
write permission to this file.
- NormalLog
- This directive defines the full path of the normal log file. Any
informative messages like unauthorized attempt to access the program (if the
program is compiled with -DCHECK_REFERER) will be written to this file.
If the program fails to open this file, the messages will be written to
stderr. Make sure that httpd has write permission to this file.
- Please look at the Makefile at the base directory of the source
distribution. The program can be compiled with various supports.
- If your system does not have strftime() routine, add
-DNO_STRFTIME flag to CFLAGS. It will then use the supplied GNU
strftime() routine. If you are using Linux, you might have to
compile with -DNO_STRFTIME option. edward@trexx.uta.edu repoted that
he had problem with AM and PM which got fixed after compiling with
-DNO_STRFTIME.
- If you want to stop remote access to the clock, add the option
-DCHECK_REFERER to CFLAGS. If the web browser supplies the
environment variable HTTP_REFERER, the remote referer host will be
extracted and compared with your host. If it differs, the request will be
denied to serve the time. If the browser does not supplies the env variable
HTTP_REFERER, time will be served anyway. If you add this flag, you
must change few lines of main.c file before compiling.
Go to the line 136 of main.c. You will see:
if ((strcmp("warm.semcor.com", rem_refh) != 0) &&
(strcmp("www.semcor.com", rem_refh) != 0) &&
(strcmp("warm", rem_refh) != 0) &&
(strcmp("www", rem_refh) != 0) &&
(strcmp("192.160.166.1", rem_refh) != 0))
{
.....
}
Here, warm.semcor.com is the machine I run the httpd server. I also
have an alias defined for it, which is www.semcor.com. It also can be
accessed locally by warm or www. The machine can be addressed
with it's IP address as well. Replace them with your host. If you do not
have any alias defined, just remove the line with www.semcor.com. Here,
you also can give remote access to any hosts you like, just add another line
with the host name.
If you do not know, any CGI program can be referred remotely, e.g.,
<img src="http://www.semcor.com/cgi-bin/dgclock.cgi">
The above method puts a stop to it in a way. There are "Counter
Terrorists", now there may be "Time Bandits" ..who knows! :-)
- At the shell prompt, type:
make clean
make
It will make the GIF image combining library at the combine directory
first, then the dgclock.cgi binary will be built.
- Copy dgclock.cgi to your system cgi-bin directory, or
elsewhere if your site allows it.
- Refer to the program from your web page as:
<img src="/cgi-bin/dgclock.cgi?ft=9|fr=69|fg=139|fb=116" align=absmiddle alt="**:**">
Please give close attention to the parameters after the ? mark. The
explanation for these parameters are given below:
ft=9
ft means frame thickness. 9 is the thinkness
in pixel. The clock will be wrapped with a 3D
frame of thickness 9. Use any value greater than 1,
however for nice 3D effect use a value >= 6.
fr=69
fr is the red component of the frame color.
It can be any value between 0 and 255.
fg=139
fg is the green component of the frame color.
Valid range: 0-255.
fb=116
fb is the blue component of the frame color.
Valid range: 0-255.
Each parameter is separated by a | character. Make sure there is no
newlines in the <img src= line and no space in the query srtring (
?ft=9|fr=69|fg=139|fb=116). Please note that fp, fr, fg and fb all have to be
in lower case. If you do not provide these parameters or if
you provide someting wrong, no frame will be wrapped around the clock. You
can be creative about the frame thickness and color.
If you do not want any frame, you can refer to the program like:
<img src="/cgi-bin/dgclock.cgi">
If you use Netscape, you can use client-pull to load the clock in every
minute. Add the following line as the first line of your web page:
<META HTTP-EQUIV="Refresh" CONTENT=60>
Note: this may not work if you are caching images in the disk, because
image will be loaded from the previous cache.
server-push hook as a option will be added for Netscape to the program
itself in the next release or so. Transparent GIF support will be there
as well.
- Copyright
- Copyright 1995 by Muhammad A Muquit. Permission to use, copy and modify
this program for personal use is hereby granted without fee, provided that
the program is not used for any financial gain and
this copyright notice appear in all copies and both that copyright notice and
this permission notice appear in supporting documentation. If the progam is
ported to some other platform, no binary only distribution is allowed, the
source and this copyright notice must be included with the distribution.
This program is provided "as is" without express or implied warranty.
Note: This program is developed in my own time. My employer
SEMCOR, Inc. has nothing to do with it.
- Acknowledgment
- Thanks to John Cristy for ImageMagick.
I took many routines from ImageMagick for the GIF image combining library.
- I like to hear from you
-
If you are using this program, I like to hear from you.
Please drop me a
line. If you are having any problem with the program, please
let me know as well. Feel free to send any suggestion. If you think that
the program is cool, please consider sending me a picture postcard of the
area where you live.
Muhammad A Muquit
SEMCOR, Inc.
65 West Street Road
Warminster, PA 18974
USA
Thanks.
Enjoy!
muquit@semcor.com
Last Update: August 20, 1995
Home Page