Solving little issue in Time Zone acronym

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Solving little issue in Time Zone acronym

Post #1by Vincent » 02.09.2006, 15:00

Hi,

Several Time Zone include brackets in their name. These brackets are often preceeded by a blank space, so the 'displayAcronym' and 'acronymify' functions make the first blanket appear in the acronym of the Time Zone name, along with the first letter of the next word.
> For example, the acronym displayed for the 'Paris, Madrid (heure d'?©t?©)' local time zone name is PM(d, instead of PM... This acronym is displayed both in the Time dialog and the Time display :
Image

I suggest a quick fix that consists in using the 'strtok' function to remove all the part of the Time Zone name after the open blanket. Here are the changes in the code :

...src/celestia/celestiacore.cpp (~ 3078)

Code: Select all

...
*overlay << d << " ";
strtok (tzname[localt->tm_isdst > 0 ? 1 : 0],  "("); //Added to solve the blanket issue in Time Zone acronym
displayAcronym(*overlay, tzname[localt->tm_isdst > 0 ? 1 : 0]);
time_displayed = true;
...


...src/celestia/wintime.cpp (~ 144)

Code: Select all

if (strchr(localTimeZoneAbbrev, ' ') != NULL)
   strtok (localTimeZoneAbbrev,  "("); //Added to solve the blanket issue in Time Zone acronym
   acronymify(localTimeZoneAbbrev, strlen(localTimeZoneAbbrev));


And here's what is eventually displayed:
Image
Note that PM is for Paris, Madrid, not for Post meridiem...
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Return to “Development”