-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLOGFILE.C
More file actions
47 lines (40 loc) · 978 Bytes
/
Copy pathLOGFILE.C
File metadata and controls
47 lines (40 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <string.h>
#include <stdio.h>
#include <time.h>
int rh(double r),rm(double r),rs(double r),da(double r),dm(double r);
/* s -> h m s muunnokset */
char ds(double i); /* deklinaation etumerkki */
FILE *lf;
int openlog()
{
lf=fopen("rade.log","a");
if(lf==NULL) printf("** tiedoston RADE.LOG avausvirhe\n");
}
int closelog()
{
return(fclose(lf));
}
writelog(text)
char *text;
{
char buffer[100];
struct tm *timeptr;
time_t timer;
time(&timer);
timeptr=localtime(&timer);
strftime(buffer,30,"%d%m%y%H%M%S",timeptr);
fprintf(lf,"%s %s\n",buffer,text);
}
void ctrll()
{
char buffer[80];
double ra,de;
double atz,alt;
extern double t; /* aika jd:n„ */
get_coord(&ra,&de);
atkor(ra,de,t,&atz,&alt);
sprintf(buffer,"r=%2.2d%2.2d%2.2d d=%c%2.2d%2.2d a=%5.1f k=%5.1f",
rh(ra),rm(ra),rs(ra),ds(de),da(de),dm(de),atz,alt);
writelog(buffer);
}