Bug 114364 - timezone is interfering with consistent plots
Summary: timezone is interfering with consistent plots
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: plotting (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: HI major
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-13 22:23 UTC by George Staikos
Modified: 2010-08-14 14:40 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description George Staikos 2005-10-13 22:23:10 UTC
the wished behavior is : 
whatever time zone, whatever computer date, kst always 
calculate the TAI to UTC with the same formula and displays 
the same date
Comment 1 Andrew Walker 2005-10-17 19:44:21 UTC
Could you indicate what setting you had for the "Timezone (hours difference from UTC)". For the situation you want the Local checkbox should be unchecked and the edit field set to 0.

If this was not the case could you please withdraw the bug or else attach more information as I am unable to reproduce the problem. 
Comment 2 George Staikos 2005-10-17 20:40:07 UTC
On Monday 17 October 2005 13:44, Andrew Walker wrote:
> ------- Could you indicate what setting you had for the "Timezone (hours
> difference from UTC)". For the situation you want the Local checkbox should
> be unchecked and the edit field set to 0.
>
> If this was not the case could you please withdraw the bug or else attach
> more information as I am unable to reproduce the problem.


   I have a patch that fixes it now.  I sent it to the reporter and they 
approved.  However it needs more thought.  I will post details ASAP.
Comment 3 Andrew Walker 2005-10-20 19:07:26 UTC
I'd be interested in seing the current patch, even if there is still some work to be done.
Comment 4 George Staikos 2005-10-21 07:35:29 UTC
On Thursday 20 October 2005 13:07, Andrew Walker wrote:
> ------- I'd be interested in seing the current patch, even if there is
> still some work to be done.


  Right now what they're working with just disables all timezone offset 
related code.  I have a patch that also adds a config variable.  This 
variable makes the timezone-disable optional.  I'm just not sure about the 
usability of it yet, so I'm not prepared to commit it.

  The disable code is just a two line patch to kst2dplot that disables the 
timezone offset call.  Nothing fancy.
Comment 5 George Staikos 2005-10-22 06:47:40 UTC
SVN commit 472821 by staikos:

Some major reworkings that don't seem to cause any visible regressions, and
other things:
1) Remove unneeded virtuals
2) KstViewObject::paint now takes a QRegion which is used in the case that the
paint is triggered by X11.  It allows us to update only the regions necessary.
-> faster
3) Add a new setting that disables timezone conversion and assumes UTC
everywhere.  This one needs more testing, and some usability thought.  It is
also ON by default.
BUG: 114364


 M  +2 -2      kst.cpp  
 M  +5 -7      kst2dplot.cpp  
 M  +1 -1      kst2dplot.h  
 M  +2 -2      kstborderedviewobject.cpp  
 M  +1 -1      kstborderedviewobject.h  
 M  +2 -2      kstplotbase.cpp  
 M  +1 -1      kstplotbase.h  
 M  +3 -9      kstplotgroup.cpp  
 M  +13 -13    kstplotgroup.h  
 M  +6 -0      kstsettings.cpp  
 M  +1 -0      kstsettings.h  
 M  +130 -96   kstsettingsdlg.ui  
 M  +8 -4      kstsettingsdlg.ui.h  
 M  +22 -22    ksttoplevelview.cpp  
 M  +2 -1      ksttoplevelview.h  
 M  +2 -2      kstviewarrow.cpp  
 M  +4 -4      kstviewarrow.h  
 M  +2 -2      kstviewbezier.cpp  
 M  +19 -19    kstviewbezier.h  
 M  +2 -2      kstviewbox.cpp  
 M  +1 -1      kstviewbox.h  
 M  +2 -2      kstviewellipse.cpp  
 M  +1 -1      kstviewellipse.h  
 M  +2 -2      kstviewlabel.cpp  
 M  +1 -1      kstviewlabel.h  
 M  +2 -3      kstviewline.cpp  
 M  +1 -1      kstviewline.h  
 M  +20 -17    kstviewobject.cpp  
 M  +1 -1      kstviewobject.h  
 M  +2 -2      kstviewpicture.cpp  
 M  +1 -1      kstviewpicture.h  
 M  +6 -1      kstviewwidget.cpp  
 M  +4 -4      kstviewwindow.cpp  
Comment 6 Andrew Walker 2005-10-22 17:47:04 UTC
I'm not convinced this was a code problem rather than a user problem. Also, how did you test your changes given that the label indicating the base time is not currently displayed due to bugs introduced by switching to KstPlotLabel?

In any case, if the time zone is now disabled then the UI should be correspondingly disabled.
Comment 7 George Staikos 2005-10-22 18:01:43 UTC
On Saturday 22 October 2005 11:47, Andrew Walker wrote:
> ------- I'm not convinced this was a code problem rather than a user
> problem. Also, how did you test your changes given that the label
> indicating the base time is not currently displayed due to bugs introduced
> by switching to KstPlotLabel?


  You're right, it's a usability problem.  I tested in the branch.

> In any case, if the time zone is now disabled then the UI should be
> correspondingly disabled.


  Most likely yes.  It needs to track state from the settings object now, 
however.  There is no means to do that at the moment.  Tracking from the 
settings dialog is error prone too, so that won't work.
Comment 8 George Staikos 2005-10-24 17:21:51 UTC
This is now the only thing preventing me from making a 1.1.1 release, which I 
would even do today.  I need to merge in the GUI options for this.  Should I 
just change KstSettings to not use direct members but instead have accessors 
for every variable and emit a signal when they change?  Then I can disable 
the input fields in the plot dialog.  I can probably finish all of that today 
and still get a release out if everyone is OK with it.
Comment 9 George Staikos 2005-10-24 21:31:26 UTC
On Monday 24 October 2005 13:03, Barth Netterfield wrote:
> I am afraid I haven't closely followed this timezone fiasco... can you
> summarize?


  There were too many cases of plots being loaded from disk and having 
different timezone settings, or even just new sessions that had the timezone 
settings wrong.  It lead to misreading of plots and other real fiascos.  It 
was requested to have a manner to globally disable timezone support because 
they didn't want it at all.  I gave them a patch that just circumvents that 
code in Kst2DPlot and all was well.  However that's no long-term solution.  
What I have right now is a global setting.  It doesn't disable the options in 
the plot dialog, it just makes them irrelevant.  The reason I didn't disable 
them is twofold:
1) KstSettings has no means to do it.  (Fixable, annoyingly.)
2) You might want to change those values for when the plot is saved to disk.  
Timezone is a plot property, not a Kst property.  The global setting is an 
override.

  It's a tough problem though.  A user might not realize his timezone settings 
aren't being used because they're disabled globally.

  We could also print a warning in the plot dialog..  "Timezone support is 
disabled.  Click here to open the settings dialog to enable."
Comment 10 Andrew Walker 2005-10-24 21:44:56 UTC
It seems the only problem was a user not understanding a feature. I don't think the quick hack was the right thing to do.

Perhaps a better solution would be to indicate the timezone in the axis label,
so that the user is aware of what timezone they are working in and can then change it if they want something different.

George, you say this can "...lead to misreading of plots and other real fiascos." Could you be more specific on what you mean by "other real fiascos".
Comment 11 George Staikos 2005-10-24 21:52:34 UTC
On Monday 24 October 2005 15:44, Andrew Walker wrote:
> ------- It seems the only problem was a user not understanding a feature. I
> don't think the quick hack was the right thing to do.


  They understand the feature and they don't like it.  They actually asked me 
to remove it altogether.

> Perhaps a better solution would be to indicate the timezone in the axis
> label, so that the user is aware of what timezone they are working in and
> can then change it if they want something different.


  I actually think they won't want this too.  They want to handle all time 
things themselves, and the whole concept of timezone disabled inside Kst.

> George, you say this can "...lead to misreading of plots and other real
> fiascos." Could you be more specific on what you mean by "other real
> fiascos". 


   Misinterpreting data, specifically.
Comment 12 George Staikos 2005-10-25 01:14:01 UTC
On Monday 24 October 2005 18:36, Barth Netterfield wrote:

> So maybe as a compromize between flexability and 'lack of confusion' we
> could: -Make timezone a kst setting, not a plot setting
> 	-Make the default UT, unless someone goes and changes it
> 	-If a plot with a converted timezone is shown, put a timezone indicator in
> the status line.
> 	-Make a compile time option to disable timezone setting to anything but UT
> for Plank, if they want it.
> This makes a window with two plots in different timezones harder to do, but
> I imagine this will be pretty rare.


  That looks good to me.
Comment 13 George Staikos 2005-10-25 17:50:28 UTC
SVN commit 474138 by staikos:

Add an option, default=on, that overrides plot timezone settings to UTC
BUG: 114364


 M  +3 -2      kst2dplot.cpp  
 M  +6 -0      kstsettings.cpp  
 M  +1 -0      kstsettings.h  
 M  +27 -1     kstsettingsdlg.ui  
 M  +3 -0      kstsettingsdlg.ui.h  


--- branches/work/kst/1.1/kst/kst/kst2dplot.cpp #474137:474138
@@ -1354,8 +1354,9 @@
       accuracy = 0;
     }
   }
-    
-  if (axisTimezoneLocal) {
+
+  if (KstSettings::globalSettings()->useUTC) {
+  } else if (axisTimezoneLocal) {
     dJD += timezoneHrs() / 24.0;
   } else {
     dJD += axisTimezoneHrs / 24.0;  
--- branches/work/kst/1.1/kst/kst/kstsettings.cpp #474137:474138
@@ -52,6 +52,8 @@
   emailEncryption = EMailEncryptionNone;
   emailAuthentication = EMailAuthenticationPLAIN;
 
+  useUTC = true;
+
   printing.pageSize = QString::number((int)KPrinter::Letter);
   printing.orientation = "Landscape";
   printing.plotDateTimeFooter = "0";
@@ -105,6 +107,8 @@
   printing.curveWidthAdjust = x.printing.curveWidthAdjust;
   printing.monochrome = x.printing.monochrome;
 
+  useUTC = x.useUTC;
+
   return *this;
 }
 
@@ -138,6 +142,7 @@
   cfg.writeEntry("Foreground Color", foregroundColor);
   cfg.writeEntry("Prompt on Window Close", promptWindowClose);
   cfg.writeEntry("Show QuickStart", showQuickStart);
+  cfg.writeEntry("Use UTC", useUTC);
 
   cfg.setGroup("Grid Lines");
   cfg.writeEntry("X Major", xMajor);
@@ -189,6 +194,7 @@
   foregroundColor = cfg.readColorEntry("Foreground Color", &foregroundColor);
   promptWindowClose = cfg.readBoolEntry("Prompt on Window Close", true);
   showQuickStart = cfg.readBoolEntry("Show QuickStart", true);
+  useUTC = cfg.readBoolEntry("Use UTC", true);
 
   cfg.setGroup("Grid Lines");
   xMajor = cfg.readBoolEntry("X Major", false);
--- branches/work/kst/1.1/kst/kst/kstsettings.h #474137:474138
@@ -64,6 +64,7 @@
     bool minorGridColorDefault : 1;
     bool xAxisInterpret : 1;
     bool yAxisInterpret : 1;
+    bool useUTC : 1;
 
     QColor majorColor;
     QColor minorColor;
--- branches/work/kst/1.1/kst/kst/kstsettingsdlg.ui #474137:474138
@@ -136,6 +136,25 @@
                     </widget>
                     <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="3">
                         <property name="name">
+                            <cstring>_utc</cstring>
+                        </property>
+                        <property name="sizePolicy">
+                            <sizepolicy>
+                                <hsizetype>0</hsizetype>
+                                <vsizetype>0</vsizetype>
+                                <horstretch>0</horstretch>
+                                <verstretch>0</verstretch>
+                            </sizepolicy>
+                        </property>
+                        <property name="text">
+                            <string>Display all times in UTC</string>
+                        </property>
+                        <property name="checked">
+                            <bool>true</bool>
+                        </property>
+                    </widget>
+                    <widget class="QCheckBox" row="5" column="0" rowspan="1" colspan="3">
+                        <property name="name">
                             <cstring>_promptWindowClose</cstring>
                         </property>
                         <property name="sizePolicy">
@@ -150,7 +169,7 @@
                             <string>Prompt before closing windows</string>
                         </property>
                     </widget>
-                    <widget class="QCheckBox" row="5" column="0" rowspan="1" colspan="4">
+                    <widget class="QCheckBox" row="6" column="0" rowspan="1" colspan="4">
                         <property name="name">
                             <cstring>_showQuickStart</cstring>
                         </property>
@@ -1049,6 +1068,12 @@
         <receiver>KstSettingsDlg</receiver>
         <slot>updateEMailSettings()</slot>
     </connection>
+    <connection>
+        <sender>_utc</sender>
+        <signal>clicked()</signal>
+        <receiver>KstSettingsDlg</receiver>
+        <slot>setDirty()</slot>
+    </connection>
 </connections>
 <tabstops>
     <tabstop>tabWidget2</tabstop>
@@ -1064,6 +1089,7 @@
     <tabstop>_checkBoxXInterpret</tabstop>
     <tabstop>_comboBoxXInterpret</tabstop>
     <tabstop>_comboBoxXDisplay</tabstop>
+    <tabstop>_utc</tabstop>
     <tabstop>_promptWindowClose</tabstop>
     <tabstop>_showQuickStart</tabstop>
     <tabstop>_source</tabstop>
--- branches/work/kst/1.1/kst/kst/kstsettingsdlg.ui.h #474137:474138
@@ -56,6 +56,7 @@
     _checkBoxAuthentication->setChecked(settings->emailRequiresAuthentication);
     _buttonGroupEncryption->setButton((int)settings->emailEncryption);
     _buttonGroupAuthentication->setButton((int)settings->emailAuthentication);
+    _utc->setChecked(settings->useUTC);
 }
 
 
@@ -107,6 +108,8 @@
     s.emailSMTPPort = _kIntSpinBoxEMailPort->value();
     s.emailRequiresAuthentication = _checkBoxAuthentication->isChecked();
 
+    s.useUTC = _utc->isChecked();
+
     int value = _buttonGroupEncryption->id(_buttonGroupEncryption->selected());
     if (value >= 0 && value < EMailEncryptionMAXIMUM) {
 	s.emailEncryption = (EMailEncryption)value;
Comment 14 Peter Kümmel 2010-08-14 14:40:44 UTC
Change version to 1.x