~ubuntu-branches/debian/squeeze/stellarium/squeeze

« back to all changes in this revision

Viewing changes to debian/patches/time_related_fix.patch

  • Committer: Bazaar Package Importer
  • Author(s): Cédric Delfosse
  • Date: 2008-05-19 21:28:23 UTC
  • mfrom: (3.1.5 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080519212823-m5nfiuntxstxzxj7
Tags: 0.9.1-4
Add libxcursor-dev, libxfixes-dev, libxinerama-dev, libqt4-opengl-dev to
build-deps (Closes: #479906)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Index: stellarium-0.9.0/src/Atmosphere.cpp
 
2
===================================================================
 
3
--- stellarium-0.9.0.orig/src/Atmosphere.cpp    2007-12-03 21:26:58.181838029 +0100
 
4
+++ stellarium-0.9.0/src/Atmosphere.cpp 2007-12-03 21:28:05.685684854 +0100
 
5
@@ -132,9 +132,8 @@
 
6
        skyb.set_sun_moon(moon_pos[2], sun_pos[2]);
 
7
 
 
8
        // Calculate the date from the julian day.
 
9
-       ln_date date;
 
10
-       get_date(JD, &date);
 
11
-       skyb.set_date(date.years, date.months, moon_phase);
 
12
+       QDate date = StelUtils::jdToQDateTime(JD).date();
 
13
+       skyb.set_date(date.year(), date.month(), moon_phase);
 
14
 
 
15
        // Variables used to compute the average sky luminance
 
16
        double sum_lum = 0.;
 
17
Index: stellarium-0.9.0/src/Navigator.cpp
 
18
===================================================================
 
19
--- stellarium-0.9.0.orig/src/Navigator.cpp     2007-12-03 21:26:58.181838029 +0100
 
20
+++ stellarium-0.9.0/src/Navigator.cpp  2007-12-03 21:28:05.685684854 +0100
 
21
@@ -73,14 +73,14 @@
 
22
        PresetSkyTime           = conf.get_double ("navigation","preset_sky_time",2451545.);
 
23
        StartupTimeMode         = conf.get_str("navigation:startup_time_mode"); // Can be "now" or "preset"
 
24
        if (StartupTimeMode=="preset" || StartupTimeMode=="Preset")
 
25
-               setJDay(PresetSkyTime - get_GMT_shift_from_system(PresetSkyTime,0) * JD_HOUR);
 
26
+               setJDay(PresetSkyTime - get_GMT_shift_from_system(PresetSkyTime) * JD_HOUR);
 
27
        else setTimeNow();
 
28
 }
 
29
 
 
30
 //! Set stellarium time to current real world time
 
31
 void Navigator::setTimeNow()
 
32
 {
 
33
-       setJDay(get_julian_from_sys());
 
34
+       setJDay(StelUtils::getJDFromSystem());
 
35
 }
 
36
 
 
37
 //! Get whether the current stellarium time is the real world time
 
38
@@ -88,11 +88,11 @@
 
39
 {
 
40
        // cache last time to prevent to much slow system call
 
41
        static double lastJD = getJDay();
 
42
-       static bool previousResult = (fabs(getJDay()-get_julian_from_sys())<JD_SECOND);
 
43
+       static bool previousResult = (fabs(getJDay()-StelUtils::getJDFromSystem())<JD_SECOND);
 
44
        if (fabs(lastJD-getJDay())>JD_SECOND/4)
 
45
        {
 
46
                lastJD = getJDay();
 
47
-               previousResult = (fabs(getJDay()-get_julian_from_sys())<JD_SECOND);
 
48
+               previousResult = (fabs(getJDay()-StelUtils::getJDFromSystem())<JD_SECOND);
 
49
        }
 
50
        return previousResult;
 
51
 }
 
52
Index: stellarium-0.9.0/src/SolarSystem.cpp
 
53
===================================================================
 
54
--- stellarium-0.9.0.orig/src/SolarSystem.cpp   2007-12-03 21:27:38.184117629 +0100
 
55
+++ stellarium-0.9.0/src/SolarSystem.cpp        2007-12-03 21:28:05.685684854 +0100
 
56
@@ -82,7 +82,7 @@
 
57
 
 
58
        // Compute position and matrix of sun and all the satellites (ie planets)
 
59
        // for the first initialization assert that center is sun center (only impacts on light speed correction)
 
60
-       computePositions(get_julian_from_sys());
 
61
+       computePositions(StelUtils::getJDFromSystem());
 
62
        setSelected("");        // Fix a bug on macosX! Thanks Fumio!
 
63
        setScale(conf.get_double ("stars:star_scale"));  // if reload config
 
64
        setFlagMoonScale(conf.get_boolean("viewing", "flag_moon_scaled", conf.get_boolean("viewing", "flag_init_moon_scaled", false)));  // name change
 
65
Index: stellarium-0.9.0/src/StelLocaleMgr.cpp
 
66
===================================================================
 
67
--- stellarium-0.9.0.orig/src/StelLocaleMgr.cpp 2007-12-03 21:27:38.184117629 +0100
 
68
+++ stellarium-0.9.0/src/StelLocaleMgr.cpp      2007-12-03 21:28:05.685684854 +0100
 
69
@@ -107,93 +107,98 @@
 
70
 // Return a string with the UTC date formated according to the date_format variable
 
71
 wstring StelLocaleMgr::get_printable_date_UTC(double JD) const
 
72
 {
 
73
-       struct tm time_utc;
 
74
-       get_tm_from_julian(JD, &time_utc);
 
75
-       
 
76
-       static char date[255];
 
77
+       QDateTime dateTime = StelUtils::jdToQDateTime(JD);
 
78
        switch(date_format)
 
79
        {
 
80
-       case S_DATE_SYSTEM_DEFAULT : StelUtils::my_strftime(date, 254, "%x", &time_utc); break;
 
81
-       case S_DATE_MMDDYYYY : StelUtils::my_strftime(date, 254, "%m/%d/%Y", &time_utc); break;
 
82
-       case S_DATE_DDMMYYYY : StelUtils::my_strftime(date, 254, "%d/%m/%Y", &time_utc); break;
 
83
-       case S_DATE_YYYYMMDD : StelUtils::my_strftime(date, 254, "%Y-%m-%d", &time_utc); break;
 
84
+               case S_DATE_SYSTEM_DEFAULT:
 
85
+                       return dateTime.toString(Qt::LocaleDate).toStdWString();
 
86
+               case S_DATE_MMDDYYYY:
 
87
+                       return dateTime.toString("MM.dd.yyyy").toStdWString();
 
88
+               case S_DATE_DDMMYYYY:
 
89
+                       return dateTime.toString("dd.MM.yyyy").toStdWString();
 
90
+               case S_DATE_YYYYMMDD:
 
91
+                       return dateTime.toString("yyyy.MM.dd").toStdWString();
 
92
+               default:
 
93
+                       return dateTime.toString(Qt::LocaleDate).toStdWString();
 
94
        }
 
95
-       return StelUtils::stringToWstring(date);
 
96
 }
 
97
 
 
98
 // Return a string with the UTC time formated according to the time_format variable
 
99
-// TODO : for some locales (french) the %p returns nothing
 
100
 wstring StelLocaleMgr::get_printable_time_UTC(double JD) const
 
101
 {
 
102
-       struct tm time_utc;
 
103
-       get_tm_from_julian(JD, &time_utc);
 
104
-       
 
105
-       static char heure[255];
 
106
+       QDateTime dateTime = StelUtils::jdToQDateTime(JD);
 
107
        switch(time_format)
 
108
        {
 
109
-       case S_TIME_SYSTEM_DEFAULT : StelUtils::my_strftime(heure, 254, "%X", &time_utc); break;
 
110
-       case S_TIME_24H : StelUtils::my_strftime(heure, 254, "%H:%M:%S", &time_utc); break;
 
111
-       case S_TIME_12H : StelUtils::my_strftime(heure, 254, "%I:%M:%S %p", &time_utc); break;
 
112
+               case S_TIME_SYSTEM_DEFAULT:
 
113
+                       return dateTime.time().toString(Qt::LocaleDate).toStdWString();
 
114
+               case S_TIME_24H:
 
115
+                       return dateTime.time().toString("HH:mm:ss").toStdWString();
 
116
+               case S_TIME_12H:
 
117
+                       return dateTime.time().toString("HH:mm:ss ap").toStdWString();
 
118
+               default:
 
119
+                       return dateTime.time().toString(Qt::LocaleDate).toStdWString();
 
120
        }
 
121
-       return StelUtils::stringToWstring(heure);
 
122
 }
 
123
 
 
124
 // Return the time in ISO 8601 format that is : %Y-%m-%d %H:%M:%S
 
125
 string StelLocaleMgr::get_ISO8601_time_local(double JD) const
 
126
 {
 
127
-       struct tm time_local;
 
128
+       QDateTime dateTime;
 
129
        if (time_zone_mode == S_TZ_GMT_SHIFT)
 
130
-               get_tm_from_julian(JD + GMT_shift, &time_local);
 
131
+               dateTime = StelUtils::jdToQDateTime(JD + GMT_shift);
 
132
        else
 
133
-               get_tm_from_julian(JD + get_GMT_shift_from_system(JD)*0.041666666666, &time_local);
 
134
-       
 
135
-       static char isotime[255];
 
136
-StelUtils::my_strftime(isotime, 254, "%Y-%m-%d %H:%M:%S", &time_local);
 
137
-       return isotime;
 
138
+               dateTime = StelUtils::jdToQDateTime(JD + get_GMT_shift_from_system(JD)*0.041666666666);
 
139
+       return dateTime.toLocalTime().toString(Qt::ISODate).toStdString();
 
140
 }
 
141
 
 
142
 
 
143
 // Return a string with the local date formated according to the date_format variable
 
144
 wstring StelLocaleMgr::get_printable_date_local(double JD) const
 
145
 {
 
146
-       struct tm time_local;
 
147
-       
 
148
+       QDateTime dateTime;
 
149
        if (time_zone_mode == S_TZ_GMT_SHIFT)
 
150
-               get_tm_from_julian(JD + GMT_shift, &time_local);
 
151
+               dateTime = StelUtils::jdToQDateTime(JD + GMT_shift);
 
152
        else
 
153
-               get_tm_from_julian(JD + get_GMT_shift_from_system(JD)*0.041666666666, &time_local);
 
154
+               dateTime = StelUtils::jdToQDateTime(JD + get_GMT_shift_from_system(JD)*0.041666666666);
 
155
+       dateTime = dateTime.toLocalTime();
 
156
        
 
157
-       static char date[255];
 
158
-       switch(date_format)
 
159
+       switch (date_format)
 
160
        {
 
161
-       case S_DATE_SYSTEM_DEFAULT : StelUtils::my_strftime(date, 254, "%x", &time_local); break;
 
162
-       case S_DATE_MMDDYYYY : StelUtils::my_strftime(date, 254, "%m/%d/%Y", &time_local); break;
 
163
-       case S_DATE_DDMMYYYY : StelUtils::my_strftime(date, 254, "%d/%m/%Y", &time_local); break;
 
164
-       case S_DATE_YYYYMMDD : StelUtils::my_strftime(date, 254, "%Y-%m-%d", &time_local); break;
 
165
+               case S_DATE_SYSTEM_DEFAULT:
 
166
+                       return dateTime.date().toString(Qt::LocaleDate).toStdWString();
 
167
+               case S_DATE_MMDDYYYY:
 
168
+                       return dateTime.date().toString("MM.dd.yyyy").toStdWString();
 
169
+               case S_DATE_DDMMYYYY:
 
170
+                       return dateTime.date().toString("dd.MM.yyyy").toStdWString();
 
171
+               case S_DATE_YYYYMMDD:
 
172
+                       return dateTime.date().toString("yyyy.MM.dd").toStdWString();
 
173
+               default:
 
174
+                       return dateTime.date().toString(Qt::LocaleDate).toStdWString();
 
175
        }
 
176
-       
 
177
-       return StelUtils::stringToWstring(date);
 
178
 }
 
179
 
 
180
 // Return a string with the local time (according to time_zone_mode variable) formated
 
181
 // according to the time_format variable
 
182
 wstring StelLocaleMgr::get_printable_time_local(double JD) const
 
183
 {
 
184
-       struct tm time_local;
 
185
-       
 
186
+       QDateTime dateTime;
 
187
        if (time_zone_mode == S_TZ_GMT_SHIFT)
 
188
-               get_tm_from_julian(JD + GMT_shift, &time_local);
 
189
+               dateTime = StelUtils::jdToQDateTime(JD + GMT_shift);
 
190
        else
 
191
-               get_tm_from_julian(JD + get_GMT_shift_from_system(JD)*0.041666666666, &time_local);
 
192
+               dateTime = StelUtils::jdToQDateTime(JD + get_GMT_shift_from_system(JD)*0.041666666666);
 
193
+       dateTime = dateTime.toLocalTime();
 
194
        
 
195
-       static char heure[255];
 
196
-       switch(time_format)
 
197
+       switch (time_format)
 
198
        {
 
199
-       case S_TIME_SYSTEM_DEFAULT : StelUtils::my_strftime(heure, 254, "%X", &time_local); break;
 
200
-       case S_TIME_24H : StelUtils::my_strftime(heure, 254, "%H:%M:%S", &time_local); break;
 
201
-       case S_TIME_12H : StelUtils::my_strftime(heure, 254, "%I:%M:%S %p", &time_local); break;
 
202
+               case S_TIME_SYSTEM_DEFAULT:
 
203
+                       return dateTime.time().toString(Qt::LocaleDate).toStdWString();
 
204
+               case S_TIME_24H:
 
205
+                       return dateTime.time().toString("HH:mm:ss").toStdWString();
 
206
+               case S_TIME_12H:
 
207
+                       return dateTime.time().toString("HH:mm:ss ap").toStdWString();
 
208
+               default:
 
209
+                       return dateTime.time().toString(Qt::LocaleDate).toStdWString();
 
210
        }
 
211
-       return StelUtils::stringToWstring(heure);
 
212
 }
 
213
 
 
214
 // Convert the time format enum to its associated string and reverse
 
215
@@ -202,7 +207,7 @@
 
216
        if (tf == "system_default") return S_TIME_SYSTEM_DEFAULT;
 
217
        if (tf == "24h") return S_TIME_24H;
 
218
        if (tf == "12h") return S_TIME_12H;
 
219
-cout << "ERROR : unrecognized time_display_format : " << tf << " system_default used." << endl;
 
220
+       cerr << "WARNING: unrecognized time_display_format : " << tf << " system_default used." << endl;
 
221
        return S_TIME_SYSTEM_DEFAULT;
 
222
 }
 
223
 
 
224
@@ -211,7 +216,7 @@
 
225
        if (tf == S_TIME_SYSTEM_DEFAULT) return "system_default";
 
226
        if (tf == S_TIME_24H) return "24h";
 
227
        if (tf == S_TIME_12H) return "12h";
 
228
-cout << "ERROR : unrecognized time_display_format value : " << tf << " system_default used." << endl;
 
229
+       cerr << "WARNING: unrecognized time_display_format value : " << tf << " system_default used." << endl;
 
230
        return "system_default";
 
231
 }
 
232
 
 
233
@@ -222,7 +227,7 @@
 
234
        if (df == "mmddyyyy") return S_DATE_MMDDYYYY;
 
235
        if (df == "ddmmyyyy") return S_DATE_DDMMYYYY;
 
236
        if (df == "yyyymmdd") return S_DATE_YYYYMMDD;  // iso8601
 
237
-cout << "ERROR : unrecognized date_display_format : " << df << " system_default used." << endl;
 
238
+       cerr << "WARNING: unrecognized date_display_format : " << df << " system_default used." << endl;
 
239
        return S_DATE_SYSTEM_DEFAULT;
 
240
 }
 
241
 
 
242
@@ -232,7 +237,7 @@
 
243
        if (df == S_DATE_MMDDYYYY) return "mmddyyyy";
 
244
        if (df == S_DATE_DDMMYYYY) return "ddmmyyyy";
 
245
        if (df == S_DATE_YYYYMMDD) return "yyyymmdd";
 
246
-       cout << "ERROR : unrecognized date_display_format value : " << df << " system_default used." << endl;
 
247
+       cerr << "WARNING: unrecognized date_display_format value : " << df << " system_default used." << endl;
 
248
        return "system_default";
 
249
 }
 
250
 
 
251
@@ -249,8 +254,8 @@
 
252
        }
 
253
 }
 
254
 
 
255
-float StelLocaleMgr::get_GMT_shift(double JD, bool _local) const
 
256
+float StelLocaleMgr::get_GMT_shift(double JD) const
 
257
 {
 
258
        if (time_zone_mode == S_TZ_GMT_SHIFT) return GMT_shift;
 
259
-       else return get_GMT_shift_from_system(JD,_local);
 
260
+       else return get_GMT_shift_from_system(JD);
 
261
 }