[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kstars/gsoc2015-ekos] kstars/auxiliary: Take UTC offset into consideration when converting from LT 
From:       Jasem Mutlaq <mutlaqja () ikarustech ! com>
Date:       2015-08-31 22:02:20
Message-ID: E1ZWX9g-0006og-CL () scm ! kde ! org
[Download RAW message or body]

Git commit 05ebd5b6cd04406e3764af4bf07442038ccaa54b by Jasem Mutlaq.
Committed on 31/08/2015 at 21:57.
Pushed by mutlaqja into branch 'gsoc2015-ekos'.

Take UTC offset into consideration when converting from LT to UT and vice versa

M  +16   -0    kstars/auxiliary/geolocation.cpp
M  +2    -3    kstars/auxiliary/geolocation.h

http://commits.kde.org/kstars/05ebd5b6cd04406e3764af4bf07442038ccaa54b

diff --git a/kstars/auxiliary/geolocation.cpp b/kstars/auxiliary/geolocation.cpp
index 5c8ea32..904bceb 100644
--- a/kstars/auxiliary/geolocation.cpp
+++ b/kstars/auxiliary/geolocation.cpp
@@ -183,4 +183,20 @@ void GeoLocation::setReadOnly(bool value)
     ReadOnly = value;
 }
 
+KStarsDateTime GeoLocation::UTtoLT( const KStarsDateTime &ut ) const
+{
+    KStarsDateTime lt = ut.addSecs( int( 3600.*TZ() ) );
+    lt.setUtcOffset(int( 3600.*TZ()));
+
+    return lt;
+}
+
+KStarsDateTime GeoLocation::LTtoUT( const KStarsDateTime &lt ) const
+{
+     KStarsDateTime ut = lt.addSecs( int( -3600.*TZ() ) );
+     ut.setUtcOffset(0);
+
+     return ut;
+}
+
 
diff --git a/kstars/auxiliary/geolocation.h b/kstars/auxiliary/geolocation.h
index c0b140a..5ffffe0 100644
--- a/kstars/auxiliary/geolocation.h
+++ b/kstars/auxiliary/geolocation.h
@@ -240,9 +240,8 @@ public:
     dms GSTtoLST( const dms &gst ) const { return dms( gst.Degrees() + Longitude.Degrees() ); }
     dms LSTtoGST( const dms &lst ) const { return dms( lst.Degrees() - Longitude.Degrees() ); }
 
-    KStarsDateTime UTtoLT( const KStarsDateTime &ut ) const { return ut.addSecs( int( 3600.*TZ() ) ); }
-    KStarsDateTime LTtoUT( const KStarsDateTime &lt ) const { return lt.addSecs( int( -3600.*TZ() ) ); }
-
+    KStarsDateTime UTtoLT( const KStarsDateTime &ut ) const;
+    KStarsDateTime LTtoUT( const KStarsDateTime &lt ) const;
 
     /** Computes the velocity in km/s of an observer on the surface of the Earth
      * referred to a system whose origin is the center of the Earth. The X and

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic