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
6
skyb.set_sun_moon(moon_pos[2], sun_pos[2]);
8
// Calculate the date from the julian day.
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);
15
// Variables used to compute the average sky luminance
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
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);
30
//! Set stellarium time to current real world time
31
void Navigator::setTimeNow()
33
- setJDay(get_julian_from_sys());
34
+ setJDay(StelUtils::getJDFromSystem());
37
//! Get whether the current stellarium time is the real world time
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)
47
- previousResult = (fabs(getJDay()-get_julian_from_sys())<JD_SECOND);
48
+ previousResult = (fabs(getJDay()-StelUtils::getJDFromSystem())<JD_SECOND);
50
return previousResult;
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
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
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
74
- get_tm_from_julian(JD, &time_utc);
76
- static char date[255];
77
+ QDateTime dateTime = StelUtils::jdToQDateTime(JD);
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();
93
+ return dateTime.toString(Qt::LocaleDate).toStdWString();
95
- return StelUtils::stringToWstring(date);
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
102
- struct tm time_utc;
103
- get_tm_from_julian(JD, &time_utc);
105
- static char heure[255];
106
+ QDateTime dateTime = StelUtils::jdToQDateTime(JD);
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();
115
+ return dateTime.time().toString("HH:mm:ss").toStdWString();
117
+ return dateTime.time().toString("HH:mm:ss ap").toStdWString();
119
+ return dateTime.time().toString(Qt::LocaleDate).toStdWString();
121
- return StelUtils::stringToWstring(heure);
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
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);
133
- get_tm_from_julian(JD + get_GMT_shift_from_system(JD)*0.041666666666, &time_local);
135
- static char isotime[255];
136
-StelUtils::my_strftime(isotime, 254, "%Y-%m-%d %H:%M:%S", &time_local);
138
+ dateTime = StelUtils::jdToQDateTime(JD + get_GMT_shift_from_system(JD)*0.041666666666);
139
+ return dateTime.toLocalTime().toString(Qt::ISODate).toStdString();
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
146
- struct tm time_local;
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);
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();
157
- static char date[255];
158
- switch(date_format)
159
+ switch (date_format)
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();
174
+ return dateTime.date().toString(Qt::LocaleDate).toStdWString();
177
- return StelUtils::stringToWstring(date);
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
184
- struct tm time_local;
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);
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();
195
- static char heure[255];
196
- switch(time_format)
197
+ switch (time_format)
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();
205
+ return dateTime.time().toString("HH:mm:ss").toStdWString();
207
+ return dateTime.time().toString("HH:mm:ss ap").toStdWString();
209
+ return dateTime.time().toString(Qt::LocaleDate).toStdWString();
211
- return StelUtils::stringToWstring(heure);
214
// Convert the time format enum to its associated string and reverse
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;
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";
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;
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";
255
-float StelLocaleMgr::get_GMT_shift(double JD, bool _local) const
256
+float StelLocaleMgr::get_GMT_shift(double JD) const
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);