Index: trunk/BNS/bns.pro
===================================================================
--- trunk/BNS/bns.pro	(revision 772)
+++ trunk/BNS/bns.pro	(revision 773)
@@ -22,8 +22,8 @@
 
 HEADERS =             bns.h   bnswindow.h   bnshlpdlg.h   bnshtml.h   \
-          bnseph.h
+          bnseph.h    bnsutils.h
 
 SOURCES = bnsmain.cpp bns.cpp bnswindow.cpp bnshlpdlg.cpp bnshtml.cpp \
-          bnseph.cpp
+          bnseph.cpp  bnsutils.cpp
 
 RC_FILE = bns.rc
Index: trunk/BNS/bnseph.cpp
===================================================================
--- trunk/BNS/bnseph.cpp	(revision 772)
+++ trunk/BNS/bnseph.cpp	(revision 773)
@@ -79,4 +79,7 @@
       >> ep->clock_bias >> ep->clock_drift >> ep->clock_driftrate;
 
+  QDate
+
+
   line = _socket->readLine();
   QTextStream in2(line);
Index: trunk/BNS/bnsutils.cpp
===================================================================
--- trunk/BNS/bnsutils.cpp	(revision 773)
+++ trunk/BNS/bnsutils.cpp	(revision 773)
@@ -0,0 +1,85 @@
+/* -------------------------------------------------------------------------
+ * BKG NTRIP Server
+ * -------------------------------------------------------------------------
+ *
+ * Class:      bncutils
+ *
+ * Purpose:    Auxiliary Functions
+ *
+ * Author:     L. Mervart
+ *
+ * Created:    08-Apr-2008
+ *
+ * Changes:    
+ *
+ * -----------------------------------------------------------------------*/
+
+#include <iostream>
+#include <ctime>
+#include <math.h>
+
+#include <QRegExp>
+#include <QStringList>
+#include <QDateTime>
+
+#include "bnsutils.h"
+
+using namespace std;
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void expandEnvVar(QString& str) {
+
+  QRegExp rx("(\\$\\{.+\\})");
+
+  if (rx.indexIn(str) != -1) {
+    QStringListIterator it(rx.capturedTexts());
+    if (it.hasNext()) {
+      QString rxStr  = it.next();
+      QString envVar = rxStr.mid(2,rxStr.length()-3);
+      str.replace(rxStr, qgetenv(envVar.toAscii()));
+    }
+  }
+
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+QDateTime dateAndTimeFromGPSweek(int GPSWeek, double GPSWeeks) {
+
+  static const QDate zeroEpoch(1980, 1, 6);
+ 
+  QDate date(zeroEpoch);
+  QTime time(0,0,0,0);
+
+  int weekDays = int(GPSWeeks) / 86400;
+  date = date.addDays( GPSWeek * 7 + weekDays );
+  time = time.addMSecs( int( (GPSWeeks - 86400 * weekDays) * 1e3 ) );
+
+  return QDateTime(date,time);
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void GPSweekFromDateAndTime(const QDateTime& dateTime, 
+                            int& GPSWeek, double& GPSWeeks) {
+
+
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void currentGPSWeeks(int& week, double& sec) {
+
+  QDateTime currDateTime = QDateTime::currentDateTime().toUTC();
+  QDate     currDate = currDateTime.date();
+  QTime     currTime = currDateTime.time();
+
+  week = int( (double(currDate.toJulianDay()) - 2444244.5) / 7 );
+
+  sec = (currDate.dayOfWeek() % 7) * 24.0 * 3600.0 + 
+        currTime.hour()                   * 3600.0 + 
+        currTime.minute()                 *   60.0 + 
+        currTime.second()                          +
+        currTime.msec()                   / 1000.0;
+}
Index: trunk/BNS/bnsutils.h
===================================================================
--- trunk/BNS/bnsutils.h	(revision 773)
+++ trunk/BNS/bnsutils.h	(revision 773)
@@ -0,0 +1,17 @@
+
+#ifndef BNSUTILS_H
+#define BNSUTILS_H
+
+#include <QString>
+#include <QDateTime>
+
+void expandEnvVar(QString& str);
+
+QDateTime dateAndTimeFromGPSweek(int GPSWeek, double GPSWeeks);
+
+void GPSweekFromDateAndTime(const QDateTime& dateTime, 
+                            int& GPSWeek, double& GPSWeeks);
+
+void currentGPSWeeks(int& week, double& sec);
+
+#endif
