]> git.mxchange.org Git - flightgear.git/blob - Simulator/Time/fg_time.hxx
Initial revision.
[flightgear.git] / Simulator / Time / fg_time.hxx
1 //
2 // fg_time.hxx -- data structures and routines for managing time related stuff.
3 //
4 // Written by Curtis Olson, started August 1997.
5 //
6 // Copyright (C) 1997  Curtis L. Olson  - curt@infoplane.com
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 // General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 //
22 // $Id$
23
24
25 #ifndef _FG_TIME_HXX
26 #define _FG_TIME_HXX
27
28
29 #ifndef __cplusplus                                                          
30 # error This library requires C++
31 #endif                                   
32
33
34 #ifdef HAVE_CONFIG_H
35 #  include <config.h>
36 #endif
37
38 #ifdef HAVE_WINDOWS_H
39 #  include <windows.h>
40 #endif
41
42 #include <GL/glut.h>
43
44 #include "Include/compiler.h"
45 #ifdef FG_HAVE_STD_INCLUDES
46 #  include <ctime>
47 #else
48 #  include <time.h>
49 #endif
50
51 #include <FDM/flight.hxx>
52
53
54 // Define a structure containing global time parameters
55 typedef struct {
56     // the date/time in various forms
57     // Unix "calendar" time in seconds
58     time_t cur_time;
59
60     // Break down of GMT time
61     struct tm *gmt;
62
63     // Julian date
64     double jd;
65
66     // modified Julian date
67     double mjd;
68
69     // side real time at prime meridian
70     double gst;
71
72     // local side real time
73     double lst;
74
75     // the difference between the precise sidereal time algorithm
76     // result and the course result.  
77     // course + diff has good accuracy for the short term
78     double gst_diff;
79
80     // An offset in seconds from the true time.  Allows us to adjust
81     // the effective time of day.
82     long int warp;
83
84     // How much to change the value of warp each iteration.  Allows us
85     // to make time progress faster than normal.
86     long int warp_delta; 
87
88     // Paused (0 = no, 1 = yes)
89     int pause;
90 } fgTIME;
91
92 extern fgTIME cur_time_params;
93
94
95 // Update time variables such as gmt, julian date, and sidereal time
96 void fgTimeInit(fgTIME *t);
97
98
99 // Update the time dependent variables
100 void fgTimeUpdate(FGInterface *f, fgTIME *t);
101
102
103 #endif // _FG_TIME_HXX
104
105