Rev | Line | |
---|
[83] | 1 |
|
---|
| 2 | /* -------------------------------------------------------------------------
|
---|
[93] | 3 | * BKG NTRIP Client
|
---|
[83] | 4 | * -------------------------------------------------------------------------
|
---|
| 5 | *
|
---|
| 6 | * Class: bncutils
|
---|
| 7 | *
|
---|
| 8 | * Purpose: Auxiliary Functions
|
---|
| 9 | *
|
---|
| 10 | * Author: L. Mervart
|
---|
| 11 | *
|
---|
| 12 | * Created: 30-Aug-2006
|
---|
| 13 | *
|
---|
| 14 | * Changes:
|
---|
| 15 | *
|
---|
| 16 | * -----------------------------------------------------------------------*/
|
---|
| 17 |
|
---|
[124] | 18 | #include <iostream>
|
---|
| 19 |
|
---|
[83] | 20 | #include <QRegExp>
|
---|
| 21 | #include <QStringList>
|
---|
| 22 |
|
---|
| 23 | #include "bncutils.h"
|
---|
| 24 |
|
---|
[124] | 25 | using namespace std;
|
---|
| 26 |
|
---|
[83] | 27 | void expandEnvVar(QString& str) {
|
---|
| 28 |
|
---|
| 29 | QRegExp rx("(\\$\\{.+\\})");
|
---|
| 30 |
|
---|
| 31 | if (rx.indexIn(str) != -1) {
|
---|
| 32 | QStringListIterator it(rx.capturedTexts());
|
---|
| 33 | if (it.hasNext()) {
|
---|
| 34 | QString rxStr = it.next();
|
---|
| 35 | QString envVar = rxStr.mid(2,rxStr.length()-3);
|
---|
| 36 | str.replace(rxStr, qgetenv(envVar.toAscii()));
|
---|
| 37 | }
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | }
|
---|
[124] | 41 |
|
---|
| 42 | QDateTime dateAndTimeFromGPSweek(int GPSWeek, double GPSWeeks) {
|
---|
| 43 |
|
---|
| 44 | static const QDate zeroEpoch(1980, 1, 6);
|
---|
| 45 |
|
---|
| 46 | QDate date(zeroEpoch);
|
---|
| 47 | QTime time(0,0,0,0);
|
---|
| 48 |
|
---|
| 49 | int weekDays = int(GPSWeeks) / 86400;
|
---|
| 50 | date = date.addDays( GPSWeek * 7 + weekDays );
|
---|
| 51 | time = time.addMSecs( int( (GPSWeeks - 86400 * weekDays) * 1e3 ) );
|
---|
| 52 |
|
---|
| 53 | return QDateTime(date,time);
|
---|
| 54 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.