home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
nisttime.carsoncity.k12.mi.us
/
nisttime.carsoncity.k12.mi.us.tar
/
nisttime.carsoncity.k12.mi.us
/
pub
/
autolock
/
putmsg.c
< prev
next >
Wrap
C/C++ Source or Header
|
2003-12-09
|
638b
|
28 lines
void putmsg(msg)
char *msg;
{
/*
this subroutine is called if the autolock program finds
a problem. it writes the text message contained in
msg. to the log file and returns.
The subroutine returns if the lock file won't open.
*/
#include <stdio.h>
#include <sys/time.h>
struct timeval tv;
FILE *lop;
int mjd;
int secoday;
if( (lop=fopen("autolock.err","a+")) == NULL) return;
/*
compute the current MJD and time and add them to the
message.
*/
gettimeofday(&tv,(struct timezone *) NULL);
mjd= tv.tv_sec/86400 + 40587;
secoday= tv.tv_sec%86400;
fprintf(lop,"\n %5d %5d",mjd,secoday);
fprintf(lop," %s",msg);
fclose(lop);
}