-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.cpp
72 lines (61 loc) · 1.69 KB
/
test.cpp
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <stdlib.h>
#include "utils.h"
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "gethostbyname_r.h"
#include <string.h>
#include "VantagePro.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include "XML.h"
#include <iostream>
#include <errno.h>
#include <iomanip>
#include "Database.h"
#include "Now.h"
#include "Almanac.h"
#include "Config.h"
#include <time.h>
int main()
{
time_t t = time(NULL);
Config cfg("test.cfg");
Debug dbg("main");
Almanac today( cfg, t);
//printf("%f\n", getJulianDay( 29, 1, 111, 0, 0, 0 ));
char buf[64];
struct tm sunriseTm;
localtime_r( &today.sunrise, &sunriseTm );
strftime( buf, 64, "%a, %d %b %Y %T %Z", &sunriseTm );
printf("sunrise: %s\n", buf );
struct tm sunsetTm;
localtime_r( &today.sunset, &sunsetTm );
strftime( buf, 64, "%a, %d %b %Y %T %Z", &sunsetTm );
printf("sunset: %s\n", buf );
printf("length of day: %02d:%02d:%02d\n",
today.lengthOfDay/3600,
(int)((today.lengthOfDay%3600)/60.0),
(int)((today.lengthOfDay%3600)%60));
//dbg.printf(EMERG, "end\n");
//alm.setNewTime( t -86400 );
//alm.setNewTime( 224769600 );
//alm.setNewTime( t + 86400 );
if ( tomorrow.lengthOfDay < today.lengthOfDay )
{
printf( "Tomorrow will be %d seconds shorter than today\n",
today.lengthOfDay - tomorrow.lengthOfDay );
}
else if ( tomorrow.lengthOfDay > today.lengthOfDay )
{
printf( "Tomorrow will be %d seconds longer than today\n",
tomorrow.lengthOfDay - today.lengthOfDay );
}
else
{
printf( "Tomorrow will be same length as today\n");
}
return 0;
}