[Kst] extragear/graphics/kst/kst
George Staikos
staikos at kde.org
Thu May 5 16:06:34 CEST 2005
SVN commit 409737 by staikos:
make it threadsafe
M +8 -6 trunk/extragear/graphics/kst/kst/kst2dplot.cpp
--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #409736:409737
@@ -6748,14 +6748,16 @@
double Kst2DPlot::timezoneHrs() {
- double timezoneHrs;
time_t t;
-
time(&t);
- timezoneHrs = difftime(mktime(gmtime(&t)), mktime(localtime(&t)));
- timezoneHrs /= -60.0 * 60.0;
-
- return timezoneHrs;
+ tm gmtResult;
+ tm ltResult;
+ tm *gmtRc = gmtime_r(&t, &gmtResult);
+ tm *ltRc = localtime_r(&t, <Result);
+ if (!gmtRc || !ltRc) {
+ return 0.0;
+ }
+ return difftime(mktime(gmtRc), mktime(ltRc)) / (-60.0 * 60.0);
}
More information about the Kst
mailing list