When Kweather calculates sunrise and sunset, it don't manage to see if the event happens the prvious day or next day, which results in that you get a false time (event day before -> 06:00, even next day -> 19:00). Reproducible: Always Steps to Reproduce: 1. emerge kde-base/kweather (if you use kde-meta) 2. Add kweather applet to your (kde) panel 3. Configure kweather to show a location 7+ hours away from you 4. View weahter report Actual Results: User in Europe (CET) who selects Seattle Sunrise: 16:45 Sunset: 19:00 Expected Results: User in Europe (CET) who selects Seattle Sunrise: 16:45 Sunset: 01:18 This affects all releases of KDE with KWeather 2.1.0, as far as I know it's at least all versions between 3.2 and 3.5.
Created attachment 74376 [details, diff] kweather_time.patch This adjusts the hour value to a correct value if the timedifference between timezones makes that an event happens the previous day or the next day. For values <0 we add 24h, for values >24 we remove 24h, this makes the time always to be valid.
Comment on attachment 74376 [details, diff] kweather_time.patch --- kweather/sun.cpp 2005-12-09 14:13:40.000000000 +0100 +++ kweather/sun.cpp 2005-12-09 14:16:12.000000000 +0100 @@ -206,6 +206,9 @@ // Example: say time is 17.7543 Then hours = 17 and minutes = 0.7543 * 60 = 45.258 int hours = (int)floor(time); int minutes = (int)floor((time - hours) * 60); + int localhours = hours + (m_localUTCOffset / 60); + if(localhours < 0) { localhours += 24; } + if(localhours >= 24) { localhours -= 24; } // Round up or down to nearest second. // Use rint instead of nearbyint because rint is in FreeBSD @@ -213,7 +216,7 @@ // Try to set the hours, minutes and seconds for the local time. // If this doesn't work, then we will return the invalid time. - result.setHMS( hours + (m_localUTCOffset / 60), minutes + (m_localUTCOffset % 60), seconds ); + result.setHMS( localhours, minutes + (m_localUTCOffset % 60), seconds ); return result; }
Can you notify the kweather devs so they can fix it in their sources? http://kweather.sourceforge.net/
Is this problem still present in the version of KWeather that comes with KDE 3.5.x?
no response - this kind of thing need to be filed at bugs.kde.org
The bug has been listed in the KDE bugzilla since KDE3.1 if I don't remember it wrong, there been a couple of suggested patches too. This has now been fixed in the KDE source, at least in 3.80. The KDE 3.5.5 still uses the unfixed source, according a post in 165267, the fixed source should be used in KDE 3.5.6, as it's still masked I haven't yet checked it. Sorry for the long delay, but as all mail out of gentoo.org is filtered away as junkmail, I had to use an e-mail address that I don't use and therefore won't get your messages.