home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
nisttime.carsoncity.k12.mi.us
/
nisttime.carsoncity.k12.mi.us.tar
/
nisttime.carsoncity.k12.mi.us
/
pub
/
lockclock
/
putleap.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-11-18
|
993b
|
35 lines
void putleap(lsflag)
int lsflag;
{
#include <stdio.h>
#include <sys/time.h>
/*
this subroutine is called when the ACTS system has
a non-zero leap-second flag indicating that a leap
second is approaching at the end of this month.
this subroutine writes a message giving the month
and year of the leap second and the type of leap
second (+ or -) as specified by the ACTS system.
lsflag is normally +1, but may be +10 if the leap
second notification is on the last day of the month.
likewise, if the flag value would have been +2, it
will be +20 on the last day of the month to show that
the event is today.
*/
FILE *iop,*fopen();
struct timeval tvv;
struct tm *gv;
void lockerr(); /*writes error message to file*/
if(lsflag >= 10) lsflag /= 10;
gettimeofday(&tvv,0);
gv=gmtime(&tvv);
if( (iop=fopen("leap.dat","wt") ) == NULL)
{
lockerr("Cannot open file leap.dat in putleap");
return;
}
fprintf(iop,"%d %d %d",gv->tm_mon+1,gv->tm_year,lsflag);
fclose(iop);
}