Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Plasma Workspace
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Merge Requests
64
Merge Requests
64
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Plasma
Plasma Workspace
Commits
0fae936b
Commit
0fae936b
authored
Jan 03, 2018
by
Friedrich W. H. Kossebau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[weather] ENVCAN: read complete observation time data
parent
587cb11b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
dataengines/weather/ions/envcan/ion_envcan.cpp
dataengines/weather/ions/envcan/ion_envcan.cpp
+13
-2
dataengines/weather/ions/envcan/ion_envcan.h
dataengines/weather/ions/envcan/ion_envcan.h
+1
-1
No files found.
dataengines/weather/ions/envcan/ion_envcan.cpp
View file @
0fae936b
...
...
@@ -27,6 +27,7 @@
#include <KUnitConversion/Converter>
#include <KLocalizedString>
#include <QTimeZone>
WeatherData
::
WeatherData
()
:
stationLat
(
qQNaN
())
...
...
@@ -754,6 +755,7 @@ void EnvCanadaIon::parseDateTime(WeatherData& data, QXmlStreamReader& xml, Weath
// What kind of date info is this?
const
QString
dateType
=
xml
.
attributes
().
value
(
QStringLiteral
(
"name"
)).
toString
();
const
QString
dateZone
=
xml
.
attributes
().
value
(
QStringLiteral
(
"zone"
)).
toString
();
const
QString
dateUtcOffset
=
xml
.
attributes
().
value
(
QStringLiteral
(
"UTCOffset"
)).
toString
();
QString
selectTimeStamp
;
...
...
@@ -792,8 +794,17 @@ void EnvCanadaIon::parseDateTime(WeatherData& data, QXmlStreamReader& xml, Weath
}
}
else
if
(
dateType
==
QLatin1String
(
"observation"
))
{
xml
.
readElementText
();
m_dateFormat
=
QDateTime
::
fromString
(
selectTimeStamp
,
QStringLiteral
(
"yyyyMMddHHmmss"
));
data
.
obsTimestamp
=
m_dateFormat
.
toString
(
QStringLiteral
(
"dd.MM.yyyy @ hh:mm"
));
QDateTime
obsDateTime
=
QDateTime
::
fromString
(
selectTimeStamp
,
QStringLiteral
(
"yyyyMMddHHmmss"
));
QTimeZone
timeZone
=
QTimeZone
(
dateZone
.
toUtf8
());
// if timezone id not recognized, fallback to utcoffset
if
(
!
timeZone
.
isValid
())
{
timeZone
=
QTimeZone
(
dateUtcOffset
.
toInt
()
*
3600
);
}
if
(
obsDateTime
.
isValid
()
&&
timeZone
.
isValid
())
{
data
.
obsDateTime
=
obsDateTime
;
data
.
obsDateTime
.
setTimeZone
(
timeZone
);
}
data
.
obsTimestamp
=
obsDateTime
.
toString
(
QStringLiteral
(
"dd.MM.yyyy @ hh:mm"
));
}
else
if
(
dateType
==
QLatin1String
(
"forecastIssue"
))
{
data
.
forecastTimestamp
=
xml
.
readElementText
();
}
else
if
(
dateType
==
QLatin1String
(
"sunrise"
))
{
...
...
dataengines/weather/ions/envcan/ion_envcan.h
View file @
0fae936b
...
...
@@ -81,6 +81,7 @@ public:
// Current observation information.
QString
obsTimestamp
;
QDateTime
obsDateTime
;
QString
condition
;
float
temperature
;
...
...
@@ -226,7 +227,6 @@ private:
QXmlStreamReader
m_xmlSetup
;
Plasma
::
DataEngine
*
m_timeEngine
;
QDateTime
m_dateFormat
;
bool
emitWhenSetup
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment