diff -pruN 1.3-1/debian/changelog 1.3-1ubuntu1/debian/changelog
--- 1.3-1/debian/changelog	2011-03-04 20:44:45.000000000 +0000
+++ 1.3-1ubuntu1/debian/changelog	2011-07-19 21:20:01.000000000 +0000
@@ -1,3 +1,11 @@
+gpredict (1.3-1ubuntu1) oneiric; urgency=low
+
+  * Apply patch from hamaa1vs to resolve the application becoming
+    unresponsive when the day or time slider is adjusted.
+    (LP: #789691)
+
+ -- Daniel T Chen <crimsun@ubuntu.com>  Tue, 19 Jul 2011 17:18:01 -0400
+
 gpredict (1.3-1) unstable; urgency=low
 
   * New upstream release, includes da.po.
diff -pruN 1.3-1/debian/control 1.3-1ubuntu1/debian/control
--- 1.3-1/debian/control	2011-03-04 20:35:49.000000000 +0000
+++ 1.3-1ubuntu1/debian/control	2011-07-19 21:17:58.000000000 +0000
@@ -1,7 +1,8 @@
 Source: gpredict
 Section: hamradio
 Priority: optional
-Maintainer: Debian Hamradio Maintainers <debian-hams@lists.debian.org>
+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
+XSBC-Original-Maintainer: Debian Hamradio Maintainers <debian-hams@lists.debian.org>
 Uploaders: Hamish Moffatt <hamish@debian.org>, Fernando M. Maresca <fmaresca@gmail.com>
 Standards-Version: 3.9.1
 Build-Depends: debhelper (>= 7), libhamlib-dev | hamlib-dev (>= 1.2.4), libgtk2.0-dev, libglib2.0-dev, libxml-parser-perl, libcurl4-gnutls-dev | libcurl-dev, libgoocanvas-dev, intltool (>>0.21.0)
diff -pruN 1.3-1/debian/patches/debian-changes-1.3-1ubuntu1 1.3-1ubuntu1/debian/patches/debian-changes-1.3-1ubuntu1
--- 1.3-1/debian/patches/debian-changes-1.3-1ubuntu1	1970-01-01 00:00:00.000000000 +0000
+++ 1.3-1ubuntu1/debian/patches/debian-changes-1.3-1ubuntu1	2011-07-19 21:24:06.000000000 +0000
@@ -0,0 +1,98 @@
+Description: Upstream changes introduced in version 1.3-1ubuntu1
+ This patch has been created by dpkg-source during the package build.
+ Here's the last changelog entry, hopefully it gives details on why
+ those changes were made:
+ .
+ gpredict (1.3-1ubuntu1) oneiric; urgency=low
+ .
+   * Apply patch from hamaa1vs to resolve the application becoming
+     unresponsive when the day or time slider is adjusted.
+     (LP: #789691)
+ .
+ The person named in the Author field signed this changelog entry.
+Author: Daniel T Chen <crimsun@ubuntu.com>
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/789691
+
+---
+The information above should follow the Patch Tagging Guidelines, please
+checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Origin: <vendor|upstream|other>, <url of original patch>
+Bug: <url in upstream bugtracker>
+Bug-Debian: http://bugs.debian.org/<bugnumber>
+Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
+Forwarded: <no|not-needed|url proving that it has been forwarded>
+Reviewed-By: <name and email of someone who approved the patch>
+Last-Update: <YYYY-MM-DD>
+
+--- gpredict-1.3.orig/src/gtk-sat-module-tmg.c
++++ gpredict-1.3/src/gtk-sat-module-tmg.c
+@@ -483,7 +483,6 @@ static void tmg_time_set (GtkWidget *wid
+     gdouble slider;
+     gdouble jd;
+ 
+-
+     /* update time only if we are in manual time control */
+     if (!mod->throttle && !mod->reset) {
+ 
+@@ -513,7 +512,7 @@ static void tmg_time_set (GtkWidget *wid
+         /* convert UTC time to Julian Date  */
+         if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME)) {
+             /* convert local time to UTC */
+-            utim = Time_to_UTC (&tim);
++            Time_to_UTC (&tim, &utim);
+ 
+             /* Convert to JD */
+             jd = Julian_Date (&utim);
+@@ -814,7 +813,7 @@ static void tmg_cal_add_one_day (GtkSatM
+     /* convert UTC time to Julian Date  */
+     if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME)) {
+         /* convert local time to UTC */
+-        utim = Time_to_UTC (&tim);
++        Time_to_UTC (&tim, &utim);
+ 
+         /* Convert to JD */
+         jd = Julian_Date (&utim);
+@@ -869,7 +868,7 @@ static void tmg_cal_sub_one_day (GtkSatM
+     /* convert UTC time to Julian Date  */
+     if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME)) {
+         /* convert local time to UTC */
+-        utim = Time_to_UTC (&tim);
++        Time_to_UTC (&tim, &utim);
+ 
+         /* Convert to JD */
+         jd = Julian_Date (&utim);
+--- gpredict-1.3.orig/src/sgpsdp/sgp4sdp4.h
++++ gpredict-1.3/src/sgpsdp/sgp4sdp4.h
+@@ -347,7 +347,7 @@ void    Time_of_Day(double jd, struct tm
+ double  Julian_Date(struct tm *cdate);
+ void    Date_Time(double jd, struct tm *cdate);
+ int     Check_Date(struct tm *cdate);
+-struct tm Time_to_UTC(struct tm *cdate);
++void Time_to_UTC(struct tm *cdate, struct tm *odate);
+ struct tm Time_from_UTC(struct tm *cdate);
+ double  JD_to_UTC(double jt);
+ double  JD_from_UTC(double jt);
+--- gpredict-1.3.orig/src/sgpsdp/sgp_time.c
++++ gpredict-1.3/src/sgpsdp/sgp_time.c
+@@ -241,13 +241,15 @@ Check_Date(struct tm *cdate)
+ /* The procedures JD_to_UTC and JD_from_UTC are used to  */
+ /* do the same thing working directly with Julian dates. */
+ 
+-struct tm
+-Time_to_UTC(struct tm *cdate)
++void
++Time_to_UTC(struct tm *cdate, struct tm *odate)
+ {
+   time_t tdate;
+-
++  cdate->tm_year -= 1900;
++  cdate->tm_isdst = -1;
+   tdate = mktime(cdate);
+-  return( *gmtime(&tdate) );
++  gmtime_r(&tdate,odate);
++  odate->tm_year += 1900;
+ } /*Procedure Time_to_UTC*/
+ 
+ /*------------------------------------------------------------------*/
diff -pruN 1.3-1/debian/patches/series 1.3-1ubuntu1/debian/patches/series
--- 1.3-1/debian/patches/series	1970-01-01 00:00:00.000000000 +0000
+++ 1.3-1ubuntu1/debian/patches/series	2011-07-19 21:20:05.000000000 +0000
@@ -0,0 +1 @@
+debian-changes-1.3-1ubuntu1
diff -pruN 1.3-1/.pc/applied-patches 1.3-1ubuntu1/.pc/applied-patches
--- 1.3-1/.pc/applied-patches	1970-01-01 00:00:00.000000000 +0000
+++ 1.3-1ubuntu1/.pc/applied-patches	2011-07-19 23:47:15.000000000 +0000
@@ -0,0 +1 @@
+debian-changes-1.3-1ubuntu1
diff -pruN 1.3-1/.pc/debian-changes-1.3-1ubuntu1/src/gtk-sat-module-tmg.c 1.3-1ubuntu1/.pc/debian-changes-1.3-1ubuntu1/src/gtk-sat-module-tmg.c
--- 1.3-1/.pc/debian-changes-1.3-1ubuntu1/src/gtk-sat-module-tmg.c	1970-01-01 00:00:00.000000000 +0000
+++ 1.3-1ubuntu1/.pc/debian-changes-1.3-1ubuntu1/src/gtk-sat-module-tmg.c	2011-02-26 20:26:28.000000000 +0000
@@ -0,0 +1,893 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+  Gpredict: Real-time satellite tracking and orbit prediction program
+
+  Copyright (C)  2001-2009  Alexandru Csete, OZ9AEC.
+
+  Authors: Alexandru Csete <oz9aec@gmail.com>
+
+  Comments, questions and bugreports should be submitted via
+  http://sourceforge.net/projects/gpredict/
+  More details can be found at the project home page:
+
+  http://gpredict.oz9aec.net/
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, visit http://www.fsf.org/
+*/
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include <sys/time.h>
+#include "sgpsdp/sgp4sdp4.h"
+#include "sat-cfg.h"
+#include "sat-log.h"
+#include "gtk-sat-module.h"
+#include "gtk-sat-module-tmg.h"
+#include "compat.h"
+
+
+
+static gint tmg_delete   (GtkWidget *, GdkEvent *, gpointer);
+static void tmg_destroy  (GtkWidget *, gpointer);
+
+static void tmg_stop     (GtkWidget *widget, gpointer data);
+static void tmg_fwd      (GtkWidget *widget, gpointer data);
+static void tmg_bwd      (GtkWidget *widget, gpointer data);
+static void tmg_reset    (GtkWidget *widget, gpointer data);
+static void tmg_throttle (GtkWidget *widget, gpointer data);
+static void tmg_time_set (GtkWidget *widget, gpointer data);
+static void slider_moved (GtkWidget *widget, gpointer data);
+static void tmg_hour_wrap (GtkWidget *widget, gpointer data);
+static void tmg_min_wrap  (GtkWidget *widget, gpointer data);
+static void tmg_sec_wrap  (GtkWidget *widget, gpointer data);
+static void tmg_msec_wrap (GtkWidget *widget, gpointer data);
+static void tmg_cal_add_one_day (GtkSatModule *mod);
+static void tmg_cal_sub_one_day (GtkSatModule *mod);
+
+
+/** \brief Create and initialise time controller widgets.
+ *  \param module The parent GtkSatModule
+ *
+ */
+void tmg_create (GtkSatModule *mod)
+{
+    GtkWidget   *vbox, *hbox, *table;
+    GtkWidget   *image;
+    GtkWidget   *label;
+    GtkTooltips *tips;
+    gchar       *title;
+    gchar       *buff;
+
+
+    /* make sure controller is not already active */
+    if (mod->tmgActive) {
+        sat_log_log (SAT_LOG_LEVEL_MSG,
+                     _("%s: Time Controller for %s is already active"),
+                     __FUNCTION__, mod->name);
+
+        /* try to make window visible in case it is covered
+                   by something else */
+        gtk_window_present (GTK_WINDOW (mod->tmgWin));
+
+        return;
+    }
+
+    /* create hbox containing the controls
+       the controls are implemented as radiobuttons in order
+       to inherit the mutual exclusion behaviour
+    */
+    hbox = gtk_hbox_new (FALSE, 0);
+
+    
+    /* FWD */
+    mod->tmgFwd = gtk_radio_button_new (NULL);
+    gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (mod->tmgFwd), FALSE);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mod->tmgFwd), TRUE);
+    image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_BUTTON);
+    gtk_container_add (GTK_CONTAINER (mod->tmgFwd), image);
+    tips = gtk_tooltips_new ();
+    gtk_tooltips_set_tip (tips, mod->tmgFwd, _("Play forward"), NULL);
+    g_signal_connect (mod->tmgFwd, "toggled", G_CALLBACK (tmg_fwd), mod);
+    gtk_box_pack_end (GTK_BOX (hbox), mod->tmgFwd, FALSE, FALSE, 0);
+
+    /* STOP */
+    mod->tmgStop = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (mod->tmgFwd));
+    gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (mod->tmgStop), FALSE);
+    image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_PAUSE, GTK_ICON_SIZE_BUTTON);
+    gtk_container_add (GTK_CONTAINER (mod->tmgStop), image);
+    tips = gtk_tooltips_new ();
+    gtk_tooltips_set_tip (tips, mod->tmgStop, _("Stop"), NULL);
+    g_signal_connect (mod->tmgStop, "toggled", G_CALLBACK (tmg_stop), mod);
+    gtk_box_pack_end (GTK_BOX (hbox), mod->tmgStop, FALSE, FALSE, 0);
+
+    /* BWD */
+    mod->tmgBwd = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (mod->tmgFwd));
+    gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (mod->tmgBwd), FALSE);
+    image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_BUTTON);
+    gtk_widget_set_direction (image, GTK_TEXT_DIR_RTL);
+    gtk_container_add (GTK_CONTAINER (mod->tmgBwd), image);
+    tips = gtk_tooltips_new ();
+    gtk_tooltips_set_tip (tips, mod->tmgBwd, _("Play backwards"), NULL);
+    g_signal_connect (mod->tmgBwd, "toggled", G_CALLBACK (tmg_bwd), mod);
+    gtk_box_pack_end (GTK_BOX (hbox), mod->tmgBwd, FALSE, FALSE, 0);
+
+    /* reset time */
+    mod->tmgReset = gtk_button_new_with_label (_("Reset"));
+    tips = gtk_tooltips_new ();
+    gtk_tooltips_set_tip (tips, mod->tmgReset, _("Reset to current date and time"), NULL);
+    g_signal_connect (mod->tmgReset, "clicked", G_CALLBACK (tmg_reset), mod);
+    gtk_box_pack_end (GTK_BOX (hbox), mod->tmgReset, FALSE, FALSE, 10);
+
+    /* status label */
+    mod->tmgState = gtk_label_new (NULL);
+    gtk_misc_set_alignment (GTK_MISC (mod->tmgState), 0.0, 0.5);
+    gtk_label_set_markup (GTK_LABEL (mod->tmgState), _("<b>Real-Time</b>"));
+    gtk_box_pack_start (GTK_BOX (hbox), mod->tmgState, TRUE, TRUE, 10);
+
+
+    /* create table containing the date and time widgets */
+    table = gtk_table_new (5, 3, FALSE);
+    gtk_table_set_row_spacings (GTK_TABLE (table), 0);
+
+    mod->tmgCal = gtk_calendar_new ();
+    gtk_calendar_set_display_options (GTK_CALENDAR (mod->tmgCal),
+                                      GTK_CALENDAR_SHOW_HEADING     |
+                                      GTK_CALENDAR_SHOW_DAY_NAMES |
+                                      GTK_CALENDAR_WEEK_START_MONDAY);
+    g_signal_connect (mod->tmgCal, "day-selected",
+                      G_CALLBACK (tmg_time_set), mod);
+    gtk_table_attach (GTK_TABLE (table), mod->tmgCal,
+                      0, 1, 0, 5, GTK_SHRINK, GTK_SHRINK,
+                      0, 0);
+
+    /* Time controllers.
+       Note that the controllers for hours, minutes, and seconds have ranges;
+       however, they can wrap around their limits in order to ensure a smooth
+       and continuous control of the time
+    */
+
+    /* hour */
+    label = gtk_label_new (_(" Hour:"));
+    gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+    gtk_table_attach (GTK_TABLE (table), label,
+                      1, 2, 0, 1, GTK_SHRINK, GTK_SHRINK, 5, 0);
+    mod->tmgHour = gtk_spin_button_new_with_range (0, 23, 1);
+    gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (mod->tmgHour), TRUE);
+    gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (mod->tmgHour),
+                                       GTK_UPDATE_IF_VALID);
+    gtk_spin_button_set_digits (GTK_SPIN_BUTTON (mod->tmgHour), 0);
+    gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (mod->tmgHour), TRUE);
+    //FIXME gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgHour), 2);
+    tips = gtk_tooltips_new ();
+    gtk_tooltips_set_tip (tips, mod->tmgHour,
+                          _("Use this control to set the hour"),
+                          NULL);
+    g_signal_connect (mod->tmgHour, "value-changed",
+                      G_CALLBACK (tmg_time_set), mod);
+    g_signal_connect (mod->tmgHour, "wrapped", G_CALLBACK (tmg_hour_wrap), mod);
+    gtk_table_attach (GTK_TABLE (table), mod->tmgHour,
+                      2, 3, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+    /* minutes */
+    label = gtk_label_new (_(" Min:"));
+    gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+    gtk_table_attach (GTK_TABLE (table), label,
+                      1, 2, 1, 2, GTK_SHRINK, GTK_SHRINK, 5, 0);
+    mod->tmgMin = gtk_spin_button_new_with_range (0, 59, 1);
+    gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (mod->tmgMin), TRUE);
+    gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (mod->tmgMin),
+                                       GTK_UPDATE_IF_VALID);
+    gtk_spin_button_set_digits (GTK_SPIN_BUTTON (mod->tmgMin), 0);
+    gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (mod->tmgMin), TRUE);
+    //FIXME gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgMin), 2);
+    tips = gtk_tooltips_new ();
+    gtk_tooltips_set_tip (tips, mod->tmgMin,
+                          _("Use this control to set the minutes"),
+                          NULL);
+    g_signal_connect (mod->tmgMin, "value-changed",
+                      G_CALLBACK (tmg_time_set), mod);
+    g_signal_connect (mod->tmgMin, "wrapped", G_CALLBACK (tmg_min_wrap), mod);
+    gtk_table_attach (GTK_TABLE (table), mod->tmgMin,
+                      2, 3, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+    /* seconds */
+    label = gtk_label_new (_(" Sec:"));
+    gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+    gtk_table_attach (GTK_TABLE (table), label,
+                      1, 2, 2, 3, GTK_SHRINK, GTK_SHRINK, 5, 0);
+    mod->tmgSec = gtk_spin_button_new_with_range (0, 59, 1);
+    gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (mod->tmgSec), TRUE);
+    gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (mod->tmgSec),
+                                       GTK_UPDATE_IF_VALID);
+    gtk_spin_button_set_digits (GTK_SPIN_BUTTON (mod->tmgSec), 0);
+    gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (mod->tmgSec), TRUE);
+    //FIXME gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgSec), 2);
+    tips = gtk_tooltips_new ();
+    gtk_tooltips_set_tip (tips, mod->tmgSec,
+                          _("Use this control to set the seconds"),
+                          NULL);
+    g_signal_connect (mod->tmgSec, "value-changed",
+                      G_CALLBACK (tmg_time_set), mod);
+    g_signal_connect (mod->tmgSec, "wrapped", G_CALLBACK (tmg_sec_wrap), mod);
+    gtk_table_attach (GTK_TABLE (table), mod->tmgSec,
+                      2, 3, 2, 3, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+    /* milliseconds */
+    label = gtk_label_new (_(" Msec:"));
+    gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+    gtk_table_attach (GTK_TABLE (table), label,
+                      1, 2, 3, 4, GTK_SHRINK, GTK_SHRINK, 5, 0);
+    mod->tmgMsec = gtk_spin_button_new_with_range (0, 999, 1);
+    gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (mod->tmgMsec), TRUE);
+    gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (mod->tmgMsec),
+                                       GTK_UPDATE_IF_VALID);
+    gtk_spin_button_set_digits (GTK_SPIN_BUTTON (mod->tmgMsec), 0);
+    gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (mod->tmgMsec), TRUE);
+    //FIXME gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgMsec), 2);
+    tips = gtk_tooltips_new ();
+    gtk_tooltips_set_tip (tips, mod->tmgMsec,
+                          _("Use this control to set the milliseconds"),
+                          NULL);
+    g_signal_connect (mod->tmgMsec, "value-changed",
+                      G_CALLBACK (tmg_time_set), mod);
+    g_signal_connect (mod->tmgMsec, "wrapped", G_CALLBACK (tmg_msec_wrap), mod);
+    gtk_table_attach (GTK_TABLE (table), mod->tmgMsec,
+                      2, 3, 3, 4, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+    /* time throttle */
+    label = gtk_label_new (_("Throttle:"));
+    gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+    gtk_table_attach (GTK_TABLE (table), label,
+                      1, 2, 4, 5, GTK_SHRINK, GTK_SHRINK, 5, 0);
+    mod->tmgFactor = gtk_spin_button_new_with_range (1, 100, 1);
+    gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (mod->tmgFactor), TRUE);
+    gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (mod->tmgFactor),
+                                       GTK_UPDATE_IF_VALID);
+    gtk_spin_button_set_digits (GTK_SPIN_BUTTON (mod->tmgFactor), 0);
+    gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgFactor), 1);
+    tips = gtk_tooltips_new ();
+    gtk_tooltips_set_tip (tips, mod->tmgFactor,
+                          _("Time throttle / compression factor"),
+                          NULL);
+    g_signal_connect (mod->tmgFactor, "value-changed",
+                      G_CALLBACK (tmg_throttle), mod);
+    gtk_table_attach (GTK_TABLE (table), mod->tmgFactor,
+                      2, 3, 4, 5, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+    /* add slider */
+    mod->tmgSlider = gtk_hscale_new_with_range (-0.1, +0.1, 0.0001);  // +/- 2.5 hr
+    /*gtk_widget_set_tooltip_text (mod->tmgSlider,
+                                 _("Drag the slider to change the time up to +/- 2.5 hours.\n"\
+                                   "Resolution is ~ 8 seconds."));*/
+    gtk_scale_set_draw_value (GTK_SCALE (mod->tmgSlider), FALSE);
+    gtk_range_set_value (GTK_RANGE (mod->tmgSlider), 0.0);
+    g_signal_connect (mod->tmgSlider, "value-changed",
+                      G_CALLBACK (slider_moved), mod);
+
+
+    /* create the vertical box */
+    vbox = gtk_vbox_new (FALSE, 0);
+
+    gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (vbox), mod->tmgSlider, FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+
+
+    /* create main window */
+    mod->tmgWin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+    title = g_strconcat (_("Time Controller"), " / ", mod->name, NULL);
+    gtk_window_set_title (GTK_WINDOW (mod->tmgWin), title);
+    g_free (title);
+    gtk_window_set_transient_for (GTK_WINDOW (mod->tmgWin),
+                                  GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (mod))));
+    g_signal_connect (G_OBJECT (mod->tmgWin), "delete_event",
+                      G_CALLBACK (tmg_delete), mod);    
+    g_signal_connect (G_OBJECT (mod->tmgWin), "destroy",
+                      G_CALLBACK (tmg_destroy), mod);
+
+    /* window icon */
+    buff = icon_file_name ("gpredict-clock.png");
+    gtk_window_set_icon_from_file (GTK_WINDOW (mod->tmgWin), buff, NULL);
+    g_free (buff);
+
+    gtk_container_add (GTK_CONTAINER (mod->tmgWin), vbox);
+    gtk_widget_show_all (mod->tmgWin);
+
+    mod->tmgActive = TRUE;
+
+    sat_log_log (SAT_LOG_LEVEL_MSG,
+                 _("%s: Time Controller for %s launched"),
+                 __FUNCTION__, mod->name);
+}
+
+
+
+/** \brief Manage tmg window delete events
+ *  \return FALSE to indicate that window should be destroyed.
+ */ 
+static gint tmg_delete   (GtkWidget *tmg, GdkEvent *event, gpointer data)
+{
+    return FALSE;
+}
+
+
+
+static void tmg_destroy  (GtkWidget *tmg, gpointer data)
+{
+    GtkSatModule *mod = GTK_SAT_MODULE (data);
+
+
+    /* reset time keeping variables */
+    mod->throttle = 1;
+    mod->tmgActive = FALSE;
+
+    /* reset time */
+    tmg_reset (NULL, data);
+
+    sat_log_log (SAT_LOG_LEVEL_MSG,
+                 _("%s: Time Controller for %s closed. Time reset."),
+                 __FUNCTION__, mod->name);
+
+}
+
+
+/** \brief Manage STOP signals.
+ *  \param widget The GtkButton that received the signal.
+ *  \param data Pointer to the GtkSatModule widget.
+ *
+ * This function is called when the user clicks on the STOP button.
+ * If the button state is active (pressed in) the function sets the
+ * throttle parameter of the module to 0.
+ */
+static void tmg_stop     (GtkWidget *widget, gpointer data)
+{
+    GtkSatModule *mod = GTK_SAT_MODULE (data);
+
+    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+
+        sat_log_log (SAT_LOG_LEVEL_DEBUG, __FUNCTION__);
+
+        /* set throttle to 0 */
+        mod->throttle = 0;
+
+    }
+
+}
+
+
+
+/** \brief Manage FWD signals.
+ *  \param widget The GtkButton that received the signal.
+ *  \param data Pointer to the GtkSatModule widget.
+ *
+ * This function is called when the user clicks on the FWD button.
+ * If the button state is active (pressed in) the function sets the
+ *  throttle parameter of the module to 1.
+ */
+static void tmg_fwd      (GtkWidget *widget, gpointer data)
+{
+    GtkSatModule *mod = GTK_SAT_MODULE (data);
+
+    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+
+        sat_log_log (SAT_LOG_LEVEL_DEBUG, __FUNCTION__);
+
+        /* set throttle */
+        mod->throttle = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgFactor));
+
+    }
+
+}
+
+
+/** \brief Manage BWD signals.
+ *  \param widget The GtkButton that received the signal.
+ *  \param data Pointer to the GtkSatModule widget.
+ *
+ * This function is called when the user clicks on the BWD button.
+ * If the button state is active (pressed in) the function sets the
+ *  throttle parameter of the module to -1.
+ */
+static void tmg_bwd      (GtkWidget *widget, gpointer data)
+{
+    GtkSatModule *mod = GTK_SAT_MODULE (data);
+
+    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+
+        sat_log_log (SAT_LOG_LEVEL_DEBUG, __FUNCTION__);
+
+        /* set throttle to -1 */
+        mod->throttle = -gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgFactor));;
+
+    }
+}
+
+
+/** \brief Manage Reset button clicks.
+ *  \param widget The button that received the "clicked" signal.
+ *  \param data Pointer to the GtkSatModule structure.
+ *
+ * This function is called when the user clicks on the Reset button.
+ * It resets the current time by setting 
+ *
+ *     mod->tmgPdnum = mod->rtPrev;
+ *     mod->tmgCdnum = mod->rtNow;
+ *
+ */
+static void tmg_reset      (GtkWidget *widget, gpointer data)
+{
+    GtkSatModule *mod = GTK_SAT_MODULE (data);
+
+    /* set reset flag in order to block
+           widget signals */
+    mod->reset = TRUE;
+
+    mod->tmgPdnum = mod->rtPrev;
+    mod->tmgCdnum = mod->rtNow;
+
+    /* RESET slider */
+    gtk_range_set_value (GTK_RANGE (mod->tmgSlider), 0.0);
+
+    /* update widgets; widget signals will have no effect
+           since the tmgReset flag is TRUE     */
+    tmg_update_widgets (mod);
+
+    /* clear reset flag */
+    mod->reset = FALSE;
+}
+
+
+
+static void tmg_throttle (GtkWidget *widget, gpointer data)
+{
+    GtkSatModule *mod = GTK_SAT_MODULE (data);
+
+
+    /* FFWD mode */
+    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (mod->tmgFwd))) {
+        mod->throttle = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
+    }
+    else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (mod->tmgBwd))) {
+        mod->throttle = -gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
+    }
+}
+
+
+/** \brief Set new date and time callback.
+ *  \param widget The widget that was modified.
+ *  \param data Pointer to the GtkSatModule structure.
+ *
+ * This function is called when the user changes the date or time in the time
+ * controller. If we are in manual time control mode, the function reads the
+ * date and time set in the control widget and calculates the new time for
+ * the module. The function does nothing in real time and simulated real
+ * time modes.
+ */
+static void tmg_time_set (GtkWidget *widget, gpointer data)
+{
+    GtkSatModule *mod = GTK_SAT_MODULE (data);
+    guint year, month, day;
+    gint  hr, min, sec, msec;
+    struct tm tim,utim;
+    gdouble slider;
+    gdouble jd;
+
+
+    /* update time only if we are in manual time control */
+    if (!mod->throttle && !mod->reset) {
+
+        /* get date and time from widgets */
+        gtk_calendar_get_date (GTK_CALENDAR (mod->tmgCal),
+                               &year, &month, &day);
+
+        hr = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgHour));
+        min = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgMin));
+        sec = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgSec));
+        msec = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgMsec));
+
+        /* build struct_tm */
+        tim.tm_year = (int) (year);
+        tim.tm_mon = (int) (month+1);
+        tim.tm_mday = (int) day;
+        tim.tm_hour = (int) hr;
+        tim.tm_min = (int) min;
+        tim.tm_sec = (int) sec;
+
+        sat_log_log (SAT_LOG_LEVEL_DEBUG,
+                     _("%s: %d/%d/%d %d:%d:%d.%d"),
+                     __FUNCTION__,
+                     tim.tm_year, tim.tm_mon, tim.tm_mday,
+                     tim.tm_hour, tim.tm_min, tim.tm_sec, msec);
+
+        /* convert UTC time to Julian Date  */
+        if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME)) {
+            /* convert local time to UTC */
+            utim = Time_to_UTC (&tim);
+
+            /* Convert to JD */
+            jd = Julian_Date (&utim);
+        }
+        else {
+            /* Already UTC, just convert to JD */
+            jd = Julian_Date (&tim);
+        }
+
+        jd = jd + (gdouble)msec/8.64e+7;
+
+        /* get slider offset */
+        slider = gtk_range_get_value (GTK_RANGE (mod->tmgSlider));
+
+        mod->tmgCdnum = jd + slider;
+    }
+}
+
+
+/** \brief Signal handler for slider "value-changed" signals
+ *  \param widget The widget that was modified.
+ *  \param data Pointer to the GtkSatModule structure.
+ *
+ * This function is called when the user moves the slider.
+ * If we are in manual control mode, the function simpley calls
+ * tmg_time_set(). In the other modes, the function switches over
+ * to amnual mode first.
+ */
+static void slider_moved (GtkWidget *widget, gpointer data)
+{
+    GtkSatModule *mod = GTK_SAT_MODULE (data);
+
+    if (mod->throttle) {
+        /* "press" the stop button to trigger a transition into manual mode */
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mod->tmgStop), TRUE);
+    }
+
+    tmg_time_set (widget, data);
+}
+
+
+/** \brief Hour controller wrap
+  * \param widget Pointer to the hour controller widget
+  * \param data Pointer to the GtkSatModule structure.
+  *
+  * This function is called when the hour controller wraps around its
+  * limits. The current day is incremented or decremented according to
+  * the wrap direction, then the current time is updated.
+  */
+static void tmg_hour_wrap  (GtkWidget *widget, gpointer data)
+{
+    GtkSatModule *mod = GTK_SAT_MODULE (data);
+    gint hour;
+
+    hour = gtk_spin_button_get_value (GTK_SPIN_BUTTON (mod->tmgHour));
+
+    if (hour == 0) {
+        /* 23 -> 0 wrap: increment date */
+        tmg_cal_add_one_day (mod);
+    }
+    else {
+        /* 0 -> 23 wrap: decrement data */
+        tmg_cal_sub_one_day (mod);
+    }
+
+}
+
+/** \brief Minute controller wrap
+  * \param widget Pointer to the minute controller widget
+  * \param data Pointer to the GtkSatModule structure.
+  *
+  * This function is called when the minute controller wraps around its
+  * limits. The current hour is incremented or decremented according to
+  * the wrap direction, then the current time is updated.
+  */
+static void tmg_min_wrap (GtkWidget *widget, gpointer data)
+{
+    GtkSatModule *mod = GTK_SAT_MODULE (data);
+    gint hr, min;
+
+    hr = gtk_spin_button_get_value (GTK_SPIN_BUTTON (mod->tmgHour));
+    min = gtk_spin_button_get_value (GTK_SPIN_BUTTON (mod->tmgMin));
+
+    if (min == 0) {
+        /* 59 -> 0 wrap: increment hour */
+        if (hr == 23) {
+            gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgHour), 0);
+            tmg_hour_wrap (mod->tmgHour, data);
+        }
+        else {
+            gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgHour), hr+1);
+        }
+    }
+    else {
+        /* 0 -> 59 wrap: decrement hour */
+        if (hr == 0) {
+            gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgHour), 23);
+            tmg_hour_wrap (mod->tmgHour, data);
+        }
+        else {
+            gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgHour), hr-1);
+        }
+    }
+
+    /* Note that the time will be updated automatically since the
+       _set_value(hour) will trigger the "value-changed" signal */
+}
+
+
+/** \brief Seconds controller wrap
+  * \param widget Pointer to the seconds controller widget
+  * \param data Pointer to the GtkSatModule structure.
+  *
+  * This function is called when the seconds controller wraps around its
+  * limits. The current minute is incremented or decremented according to
+  * the wrap direction, then the current time is updated.
+  */
+static void tmg_sec_wrap (GtkWidget *widget, gpointer data)
+{
+    GtkSatModule *mod = GTK_SAT_MODULE (data);
+    gint min, sec;
+
+    sec = gtk_spin_button_get_value (GTK_SPIN_BUTTON (mod->tmgSec));
+    min = gtk_spin_button_get_value (GTK_SPIN_BUTTON (mod->tmgMin));
+
+    if (sec == 0) {
+        /* 59 -> 0 wrap: increment minute */
+        if (min == 59) {
+            gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgMin), 0);
+            tmg_min_wrap (mod->tmgMin, data);
+        }
+        else {
+            gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgMin), min+1);
+        }
+    }
+    else {
+        /* 0 -> 59 wrap: decrement minute */
+        if (min == 0) {
+            gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgMin), 59);
+            tmg_min_wrap (mod->tmgMin, data);
+        }
+        else {
+            gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgMin), min-1);
+        }
+    }
+
+    /* Note that the time will be updated automatically since the
+       _set_value(minute) will trigger the "value-changed" signal */
+}
+
+
+/** \brief Millisecond controller wrap
+  * \param widget Pointer to the millisecond controller widget
+  * \param data Pointer to the GtkSatmodule structure.
+  *
+  * This function is called when the muillisecond controller wraps around its
+  * limits. The current second is incremented or decremented according to
+  * the wrap direction, then the current time is updated.
+  */
+static void tmg_msec_wrap (GtkWidget *widget, gpointer data)
+{
+    GtkSatModule *mod = GTK_SAT_MODULE (data);
+    gint msec, sec;
+
+    sec = gtk_spin_button_get_value (GTK_SPIN_BUTTON (mod->tmgSec));
+    msec = gtk_spin_button_get_value (GTK_SPIN_BUTTON (mod->tmgMsec));
+
+    if (msec == 0) {
+        /* 999 -> 0 wrap: increment seconds */
+        if (sec == 59) {
+            gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgSec), 0);
+            tmg_sec_wrap (mod->tmgSec, data);
+        }
+        else {
+            gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgSec), sec+1);
+        }
+    }
+    else {
+        /* 0 -> 999 wrap: decrement seconds */
+        if (sec == 0) {
+            gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgSec), 59);
+            tmg_sec_wrap (mod->tmgSec, data);
+        }
+        else {
+            gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgSec), sec-1);
+        }
+    }
+
+    /* Note that the time will be updated automatically since the
+       _set_value(sec) will trigger the "value-changed" signal */
+}
+
+
+
+
+
+/** \brief Update Time controller widgets
+ *  \param mod Pointer to the GtkSatModule widget
+ */
+void tmg_update_widgets (GtkSatModule *mod)
+{
+    struct tm tim;
+    time_t    t;
+
+    /* update time widgets */
+    t = (mod->tmgCdnum - 2440587.5)*86400.;
+
+    if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME)) {
+        tim = *localtime (&t);
+    }
+    else {
+        tim = *gmtime (&t);
+    }
+
+    /* hour */
+    gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgHour),
+                               tim.tm_hour);
+
+    /* min */
+    gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgMin),
+                               tim.tm_min);
+
+    /* sec */
+    gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgSec),
+                               tim.tm_sec);
+
+    /* msec: alway 0 in RT and SRT modes */
+    gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgMsec), 0);
+
+
+    /* calendar */
+    gtk_calendar_select_month (GTK_CALENDAR (mod->tmgCal),
+                               tim.tm_mon, tim.tm_year+1900);
+    gtk_calendar_select_day (GTK_CALENDAR (mod->tmgCal), tim.tm_mday);
+
+}
+
+
+/** \brief Update state label.
+ *  \param mod Pointer to the GtkSatModule widget
+ *
+ * This function is used to update the state label showing
+ * whether the time control is in RT, SRT, or MAN mode.
+ *
+ */
+void tmg_update_state (GtkSatModule *mod)
+{
+
+
+    if (mod->rtPrev != mod->tmgPdnum) {
+        if (mod->throttle) {
+            gtk_label_set_markup (GTK_LABEL (mod->tmgState),
+                                  _("<b>Simulated Real-Time</b>"));
+        }
+        else {
+            gtk_label_set_markup (GTK_LABEL (mod->tmgState),
+                                  _("<b>Manual Control</b>"));
+        }
+    }
+    else
+        gtk_label_set_markup (GTK_LABEL (mod->tmgState),
+                              _("<b>Real-Time</b>"));
+
+
+}
+
+
+/** \brief Add one day to the calendar */
+static void tmg_cal_add_one_day (GtkSatModule *mod)
+{
+    guint year, month, day;
+    gint  hr, min, sec, msec;
+    struct tm tim,utim;
+    gdouble jd;
+
+
+    /* calculate the new time as in tmg_time_set */
+    gtk_calendar_get_date (GTK_CALENDAR (mod->tmgCal), &year, &month, &day);
+    hr = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgHour));
+    min = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgMin));
+    sec = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgSec));
+    msec = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgMsec));
+
+    /* build struct_tm */
+    tim.tm_year = (int) (year);
+    tim.tm_mon = (int) (month+1);
+    tim.tm_mday = (int) day;
+    tim.tm_hour = (int) hr;
+    tim.tm_min = (int) min;
+    tim.tm_sec = (int) sec;
+
+    sat_log_log (SAT_LOG_LEVEL_DEBUG,
+                 _("%s: %d/%d/%d %d:%d:%d.%d"),
+                 __FUNCTION__,
+                 tim.tm_year, tim.tm_mon, tim.tm_mday,
+                 tim.tm_hour, tim.tm_min, tim.tm_sec, msec);
+
+    /* convert UTC time to Julian Date  */
+    if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME)) {
+        /* convert local time to UTC */
+        utim = Time_to_UTC (&tim);
+
+        /* Convert to JD */
+        jd = Julian_Date (&utim);
+    }
+    else {
+        /* Already UTC, just convert to JD */
+        jd = Julian_Date (&tim);
+    }
+
+    jd = jd + (gdouble)msec/8.64e+7;
+
+    /* add one day */
+    jd += 1;
+
+    mod->tmgCdnum = jd;
+
+    /* now call tmg_update_widgets */
+    tmg_update_widgets (mod);
+}
+
+
+/** \brief Substract one day from the calendar */
+static void tmg_cal_sub_one_day (GtkSatModule *mod)
+{
+    guint year, month, day;
+    gint  hr, min, sec, msec;
+    struct tm tim,utim;
+    gdouble jd;
+
+
+    /* calculate the new time as in tmg_time_set */
+    gtk_calendar_get_date (GTK_CALENDAR (mod->tmgCal), &year, &month, &day);
+    hr = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgHour));
+    min = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgMin));
+    sec = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgSec));
+    msec = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgMsec));
+
+    /* build struct_tm */
+    tim.tm_year = (int) (year);
+    tim.tm_mon = (int) (month+1);
+    tim.tm_mday = (int) day;
+    tim.tm_hour = (int) hr;
+    tim.tm_min = (int) min;
+    tim.tm_sec = (int) sec;
+
+    sat_log_log (SAT_LOG_LEVEL_DEBUG,
+                 _("%s: %d/%d/%d %d:%d:%d.%d"),
+                 __FUNCTION__,
+                 tim.tm_year, tim.tm_mon, tim.tm_mday,
+                 tim.tm_hour, tim.tm_min, tim.tm_sec, msec);
+
+    /* convert UTC time to Julian Date  */
+    if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME)) {
+        /* convert local time to UTC */
+        utim = Time_to_UTC (&tim);
+
+        /* Convert to JD */
+        jd = Julian_Date (&utim);
+    }
+    else {
+        /* Already UTC, just convert to JD */
+        jd = Julian_Date (&tim);
+    }
+
+    jd = jd + (gdouble)msec/8.64e+7;
+
+    /* substract one day */
+    jd -= 1;
+
+    mod->tmgCdnum = jd;
+
+    /* now call tmg_update_widgets */
+    tmg_update_widgets (mod);
+}
+
+
diff -pruN 1.3-1/.pc/debian-changes-1.3-1ubuntu1/src/sgpsdp/sgp4sdp4.h 1.3-1ubuntu1/.pc/debian-changes-1.3-1ubuntu1/src/sgpsdp/sgp4sdp4.h
--- 1.3-1/.pc/debian-changes-1.3-1ubuntu1/src/sgpsdp/sgp4sdp4.h	1970-01-01 00:00:00.000000000 +0000
+++ 1.3-1ubuntu1/.pc/debian-changes-1.3-1ubuntu1/src/sgpsdp/sgp4sdp4.h	2011-02-26 20:26:25.000000000 +0000
@@ -0,0 +1,365 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+
+#ifndef SGP4SDP4_H
+#define SGP4SDP4_H 1
+
+#include <math.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+/* #include <unistd.h> */
+
+/* from David Kaelbling <drk@sgi.com> */
+#define select duplicate_select
+#include <unistd.h>
+#undef select
+
+
+/** Type definitions **/
+
+
+typedef enum {
+	ORBIT_TYPE_UNKNOWN = 0,
+	ORBIT_TYPE_LEO,            /*!< Low Earth orbit, up to 1200 km. */
+	ORBIT_TYPE_ICO,            /*!< Intermediate Circular Orbit, up to 1400 km. */ 
+	ORBIT_TYPE_GEO,            /*!< Geostationary. */
+	ORBIT_TYPE_GSO,            /*!< Geosynchronuous. */
+	ORBIT_TYPE_MOLNIYA,
+	ORBIT_TYPE_TUNDRA,
+	ORBIT_TYPE_POLAR,
+	ORBIT_TYPE_SUNSYNC,
+	ORBIT_TYPE_DECAYED
+} orbit_type_t;
+
+/** \brief Operational status of satellite. */
+typedef enum {
+	OP_STAT_UNKNOWN = 0,
+	OP_STAT_OPERATIONAL,  /*!< Operational           [+] */
+	OP_STAT_NONOP,        /*!< Nonoperational        [-] */
+	OP_STAT_PARTIAL,      /*!< Partially operational [P] */
+	OP_STAT_STDBY,        /*!< Backup/Standby        [B] */
+	OP_STAT_SPARE,        /*!< Spare                 [S] */
+	OP_STAT_EXTENDED      /*!< Extended Mission      [X] */
+} op_stat_t;
+
+
+/** \brief Two-line-element satellite orbital data.
+ *  \ingroup sgpsdpif
+ *  \bug doc incomplete.
+ */
+typedef struct {
+    double epoch;            /*!< Epoch Time in NORAD TLE format YYDDD.FFFFFFFF */
+	unsigned int epoch_year; /*!< Epoch: year */
+	unsigned int epoch_day;  /*!< Epoch: day of year */
+	double epoch_fod;        /*!< Epoch: Fraction of day. */
+	double xndt2o;           /*!< 1. time derivative of mean motion */
+	double xndd6o;           /*!< 2. time derivative of mean motion */
+	double bstar;            /*!< Bstar drag coefficient. */
+	double xincl;            /*!< Inclination */
+	double xnodeo;           /*!< R.A.A.N. */
+	double eo;               /*!< Eccentricity */
+	double omegao;           /*!< argument of perigee */
+	double xmo;              /*!< mean anomaly */
+	double xno;              /*!< mean motion */
+
+	int    catnr;            /*!< Catalogue Number.  */
+	int    elset;            /*!< Element Set number. */
+	int    revnum;           /*!< Revolution Number at epoch. */
+
+        char   sat_name[25];     /*!< Satellite name string. */
+	char   idesg[9];         /*!< International Designator. */
+	op_stat_t status;        /*!< Operational status. */
+
+	/* values needed for squint calculations */
+	double xincl1;
+	double xnodeo1;
+	double omegao1;
+} tle_t; 
+	
+
+/** \brief Geodetic position data structure.
+ *  \ingroup sgpsdpif
+ *
+ * \bug It is uncertain whether the units are uniform across all functions.
+ */
+typedef struct {
+	double lat;    /*!< Lattitude [rad] */
+	double lon;    /*!< Longitude [rad] */
+	double alt;    /*!< Altitude [km]? */
+	double theta;
+} geodetic_t;
+
+/** \brief General three-dimensional vector structure.
+ *  \ingroup sgpsdpif
+ */
+typedef struct {
+	double x;   /*!< X component */
+	double y;   /*!< Y component */
+	double z;   /*!< Z component */
+	double w;   /*!< Magnitude */
+} vector_t;
+
+
+/** \brief Bearing to satellite from observer
+ *  \ingroup sgpsdpif
+ */
+typedef struct {
+	double az;            /*!< Azimuth [deg] */
+	double el;            /*!< Elevation [deg] */
+	double range;         /*!< Range [km] */
+	double range_rate;    /*!< Velocity [km/sec] */
+} obs_set_t;
+
+typedef struct {
+	double ra;   /*!< Right Ascension [dec] */
+	double dec;  /*!< Declination [dec] */
+} obs_astro_t;
+
+
+/* Common arguments between deep-space functions */
+typedef struct {
+	/* Used by dpinit part of Deep() */
+	double eosq,sinio,cosio,betao,aodp,theta2,sing,cosg;
+	double betao2,xmdot,omgdot,xnodot,xnodp;
+
+	/* Used by dpsec and dpper parts of Deep() */
+	double xll,omgadf,xnode,em,xinc,xn,t;
+
+	/* Used by thetg and Deep() */
+	double ds50;
+} deep_arg_t;
+
+/* static data for SGP4 and SDP4 */
+typedef struct {
+	double aodp,aycof,c1,c4,c5,cosio,d2,d3,d4,delmo,omgcof;
+	double eta,omgdot,sinio,xnodp,sinmo,t2cof,t3cof,t4cof,t5cof;
+	double x1mth2,x3thm1,x7thm1,xmcof,xmdot,xnodcf,xnodot,xlcof;
+} sgpsdp_static_t;
+
+/* static data for DEEP */
+typedef struct {
+	double thgr,xnq,xqncl,omegaq,zmol,zmos,savtsn,ee2,e3,xi2;
+	double xl2,xl3,xl4,xgh2,xgh3,xgh4,xh2,xh3,sse,ssi,ssg,xi3;
+	double se2,si2,sl2,sgh2,sh2,se3,si3,sl3,sgh3,sh3,sl4,sgh4;
+	double ssl,ssh,d3210,d3222,d4410,d4422,d5220,d5232,d5421;
+	double d5433,del1,del2,del3,fasx2,fasx4,fasx6,xlamo,xfact;
+	double xni,atime,stepp,stepn,step2,preep,pl,sghs,xli;
+	double d2201,d2211,sghl,sh1,pinc,pe,shs,zsingl,zcosgl;
+	double zsinhl,zcoshl,zsinil,zcosil;
+} deep_static_t;
+
+/** \brief Satellite data structure
+ *  \ingroup sgpsdpif
+ *
+ */
+typedef struct {
+        char           *name;
+        char           *nickname;
+        char           *website;
+	tle_t           tle;     /*!< Keplerian elements */
+	int             flags;   /*!< Flags for algo ctrl */
+	sgpsdp_static_t sgps;
+	deep_static_t   dps;
+	deep_arg_t      deep_arg;
+	vector_t        pos;       /*!< Raw position and range */
+	vector_t        vel;       /*!< Raw velocity */
+
+	/*** FIXME: REMOVE */
+	obs_set_t       bearing;   /*!< Az, El, range and vel */
+	obs_astro_t     astro;     /*!< Ra and Decl */
+	/*** END */
+
+	/* time keeping fields */
+	double          jul_epoch;
+	double          jul_utc;
+	double          tsince;
+	double          aos;         /*!< Next AOS. */
+	double          los;         /*!< Next LOS */
+
+	double          az;          /*!< Azimuth [deg] */
+	double          el;          /*!< Elevation [deg] */
+	double          range;       /*!< Range [km] */
+	double          range_rate;  /*!< Range Rate [km/sec] */
+	double          ra;          /*!< Right Ascension [deg] */
+	double          dec;         /*!< Declination [deg] */
+	double          ssplat;      /*!< SSP latitude [deg] */
+	double          ssplon;      /*!< SSP longitude [deg] */
+	double          alt;         /*!< altitude [km] */
+	double          velo;        /*!< velocity [km/s] */
+	double          ma;          /*!< mean anomaly */
+	double          footprint;   /*!< footprint */
+	double          phase;       /*!< orbit phase */
+	double          meanmo;      /*!< mean motion kept in rev/day */
+	unsigned long   orbit;       /*!< orbit number */
+	orbit_type_t    otype;       /*!< orbit type. */
+} sat_t;
+
+
+/** \brief Type casting macro */
+#define SAT(sat)  ((sat_t *) sat)
+
+
+/** Table of constant values **/
+#define de2ra    1.74532925E-2   /* Degrees to Radians */
+#define pi       3.1415926535898 /* Pi */
+#define pio2     1.5707963267949 /* Pi/2 */
+#define x3pio2   4.71238898      /* 3*Pi/2 */
+#define twopi    6.2831853071796 /* 2*Pi  */
+#define e6a      1.0E-6
+#define tothrd   6.6666667E-1    /* 2/3 */
+#define xj2      1.0826158E-3    /* J2 Harmonic */
+#define xj3     -2.53881E-6      /* J3 Harmonic */   
+#define xj4     -1.65597E-6      /* J4 Harmonic */
+#define xke      7.43669161E-2
+#define xkmper   6.378135E3      /* Earth radius km */
+#define xmnpda   1.44E3          /* Minutes per day */
+#define ae       1.0
+#define ck2      5.413079E-4
+#define ck4      6.209887E-7
+#define __f      3.352779E-3
+#define ge       3.986008E5 
+#define __s__    1.012229
+#define qoms2t   1.880279E-09
+#define secday   8.6400E4        /* Seconds per day */
+#define omega_E  1.0027379
+#define omega_ER 6.3003879
+#define zns      1.19459E-5
+#define c1ss     2.9864797E-6
+#define zes      1.675E-2
+#define znl      1.5835218E-4
+#define c1l      4.7968065E-7
+#define zel      5.490E-2
+#define zcosis   9.1744867E-1
+#define zsinis   3.9785416E-1
+#define zsings  -9.8088458E-1
+#define zcosgs   1.945905E-1
+#define zcoshs   1
+#define zsinhs   0
+#define q22      1.7891679E-6
+#define q31      2.1460748E-6
+#define q33      2.2123015E-7
+#define g22      5.7686396
+#define g32      9.5240898E-1
+#define g44      1.8014998
+#define g52      1.0508330
+#define g54      4.4108898
+#define root22   1.7891679E-6
+#define root32   3.7393792E-7
+#define root44   7.3636953E-9
+#define root52   1.1428639E-7
+#define root54   2.1765803E-9
+#define thdt     4.3752691E-3
+#define rho      1.5696615E-1
+#define mfactor  7.292115E-5
+#define __sr__   6.96000E5      /*Solar radius - kilometers (IAU 76)*/
+#define AU       1.49597870E8   /*Astronomical unit - kilometers (IAU 76)*/
+
+/* Entry points of Deep() 
+FIXME: Change to enu */
+#define dpinit   1 /* Deep-space initialization code */
+#define dpsec    2 /* Deep-space secular code        */
+#define dpper    3 /* Deep-space periodic code       */
+
+/* Carriage return and line feed */
+#define CR  0x0A
+#define LF  0x0D
+
+/* Flow control flag definitions */
+#define ALL_FLAGS              -1
+#define SGP_INITIALIZED_FLAG   0x000001
+#define SGP4_INITIALIZED_FLAG  0x000002
+#define SDP4_INITIALIZED_FLAG  0x000004
+#define SGP8_INITIALIZED_FLAG  0x000008
+#define SDP8_INITIALIZED_FLAG  0x000010
+#define SIMPLE_FLAG            0x000020
+#define DEEP_SPACE_EPHEM_FLAG  0x000040
+#define LUNAR_TERMS_DONE_FLAG  0x000080
+#define NEW_EPHEMERIS_FLAG     0x000100
+#define DO_LOOP_FLAG           0x000200
+#define RESONANCE_FLAG         0x000400
+#define SYNCHRONOUS_FLAG       0x000800
+#define EPOCH_RESTART_FLAG     0x001000
+#define VISIBLE_FLAG           0x002000
+#define SAT_ECLIPSED_FLAG      0x004000
+
+
+/** Function prototypes **/
+
+
+/* sgp4sdp4.c */
+void    SGP4 (sat_t *sat, double tsince);
+void    SDP4 (sat_t *sat, double tsince);
+void    Deep (int ientry, sat_t *sat);
+int     isFlagSet(int flag);
+int     isFlagClear(int flag);
+void    SetFlag(int flag);
+void    ClearFlag(int flag);
+
+/* sgp_in.c */
+int     Checksum_Good(char *tle_set);
+int     Good_Elements(char *tle_set);
+void    Convert_Satellite_Data(char *tle_set, tle_t *tle);
+int     Get_Next_Tle_Set( char lines[3][80], tle_t *tle );
+void    select_ephemeris(sat_t *sat);
+
+/* sgp_math.c */
+int     Sign(double arg);
+double  Sqr(double arg);
+double  Cube(double arg);
+double  Radians(double arg);
+double  Degrees(double arg);
+double  ArcSin(double arg);
+double  ArcCos(double arg);
+void    Magnitude(vector_t *v);
+void    Vec_Add(vector_t *v1, vector_t *v2, vector_t *v3);
+void    Vec_Sub(vector_t *v1, vector_t *v2, vector_t *v3);
+void    Scalar_Multiply(double k, vector_t *v1, vector_t *v2);
+void    Scale_Vector(double k, vector_t *v);
+double  Dot(vector_t *v1, vector_t *v2);
+double  Angle(vector_t *v1, vector_t *v2);
+void    Cross(vector_t *v1, vector_t *v2, vector_t *v3);
+void    Normalize(vector_t *v);
+double  AcTan(double sinx, double cosx);
+double  FMod2p(double x);
+double  Modulus(double arg1, double arg2);
+double  Frac(double arg);
+int     Round(double arg);
+double  Int(double arg);
+void    Convert_Sat_State(vector_t *pos, vector_t *vel);
+
+/* sgp_obs.c */
+void    Calculate_User_PosVel(double _time, geodetic_t *geodetic,
+                              vector_t *obs_pos, vector_t *obs_vel);
+void    Calculate_LatLonAlt(double _time, vector_t *pos, geodetic_t *geodetic);
+void    Calculate_Obs(double _time, vector_t *pos, vector_t *vel,
+                      geodetic_t *geodetic, obs_set_t *obs_set);
+void    Calculate_RADec_and_Obs(double _time, vector_t *pos, vector_t *vel,
+				geodetic_t *geodetic, obs_astro_t *obs_set);
+
+/* sgp_time.c */
+double  Julian_Date_of_Epoch(double epoch);
+double  Epoch_Time(double jd);
+int     DOY(int yr, int mo, int dy);
+double  Fraction_of_Day(int hr, int mi, int se);
+void    Calendar_Date(double jd, struct tm *cdate);
+void    Time_of_Day(double jd, struct tm *cdate);
+double  Julian_Date(struct tm *cdate);
+void    Date_Time(double jd, struct tm *cdate);
+int     Check_Date(struct tm *cdate);
+struct tm Time_to_UTC(struct tm *cdate);
+struct tm Time_from_UTC(struct tm *cdate);
+double  JD_to_UTC(double jt);
+double  JD_from_UTC(double jt);
+double  Delta_ET(double year);
+double  Julian_Date_of_Year(double year);
+double  ThetaG(double epoch, deep_arg_t *deep_arg);
+double  ThetaG_JD(double jd);
+void    UTC_Calendar_Now(struct tm *cdate);
+
+/* solar.c */
+void    Calculate_Solar_Position(double _time, vector_t *solar_vector);
+int     Sat_Eclipsed(vector_t *pos, vector_t *sol, double *depth);
+
+
+#endif
diff -pruN 1.3-1/.pc/debian-changes-1.3-1ubuntu1/src/sgpsdp/sgp_time.c 1.3-1ubuntu1/.pc/debian-changes-1.3-1ubuntu1/src/sgpsdp/sgp_time.c
--- 1.3-1/.pc/debian-changes-1.3-1ubuntu1/src/sgpsdp/sgp_time.c	1970-01-01 00:00:00.000000000 +0000
+++ 1.3-1ubuntu1/.pc/debian-changes-1.3-1ubuntu1/src/sgpsdp/sgp_time.c	2011-02-26 20:26:25.000000000 +0000
@@ -0,0 +1,428 @@
+/*
+ * Unit SGP_Time
+ *       Author:  Dr TS Kelso
+ * Original Version:  1992 Jun 02
+ * Current Revision:  2000 Jan 22
+ * Modified for Y2K:  1999 Mar 07
+ *          Version:  2.05
+ *        Copyright:  1992-1999, All Rights Reserved
+ * Version 1.50 added Y2K support. Due to limitations in the current
+ * format of the NORAD two-line element sets, however, only dates
+ * through 2056 December 31/2359 UTC are valid.
+ * Version 1.60 modifies Calendar_Date to ensure date matches time
+ * resolution and modifies Time_of_Day to make it more robust.
+ * Version 2.00 adds Julian_Date, Date_Time, and Check_Date to support
+ * checking for valid date/times, permitting the use of Time_to_UTC and
+ * Time_from_UTC for UTC/local time conversions.
+ * Version 2.05 modifies UTC_offset to allow non-integer offsets.
+ *
+ *   Ported to C by: Neoklis Kyriazis  April 9  2001
+ */
+
+#include "sgp4sdp4.h"
+
+/* The function Julian_Date_of_Epoch returns the Julian Date of     */
+/* an epoch specified in the format used in the NORAD two-line      */
+/* element sets. It has been modified to support dates beyond       */
+/* the year 1999 assuming that two-digit years in the range 00-56   */
+/* correspond to 2000-2056. Until the two-line element set format   */
+/* is changed, it is only valid for dates through 2056 December 31. */
+
+double
+Julian_Date_of_Epoch(double epoch)
+{ 
+  double year,day;
+
+  /* Modification to support Y2K */
+  /* Valid 1957 through 2056     */
+  day = modf(epoch*1E-3, &year)*1E3;
+  if( year < 57 )
+    year = year + 2000;
+  else
+    year = year + 1900;
+  /* End modification */
+
+  return( Julian_Date_of_Year(year) + day );
+} /*Function Julian_Date_of_Epoch*/
+
+/*------------------------------------------------------------------*/
+
+/* Converts a Julian epoch to NORAD TLE epoch format */
+double
+Epoch_Time(double jd)
+{  
+  double yr,_time,epoch_time;
+  struct tm edate;
+
+  Calendar_Date(jd, &edate);
+  yr = edate.tm_year - 100*(edate.tm_year/100) ;
+  _time = Frac(jd + 0.5);
+  epoch_time =  yr*1000
+                + DOY(edate.tm_year, edate.tm_mon, edate.tm_mday)
+                + _time;
+
+  return( epoch_time );
+} /*Function Epoch_Time*/
+
+/*------------------------------------------------------------------*/
+
+/* The function DOY calculates the day of the year for the specified */
+/* date. The calculation uses the rules for the Gregorian calendar   */
+/* and is valid from the inception of that calendar system.          */
+int
+DOY(int yr, int mo, int dy)
+{
+  const int days[] = {31,28,31,30,31,30,31,31,30,31,30,31};
+  int i,day;
+
+  day = 0;
+  for( i = 0; i < mo-1; i++ )
+    day += days[i];
+  day = day + dy;
+
+  /* Leap year correction */
+  if( 
+     (yr%4 == 0) && ((yr%100 != 0) || (yr%400 == 0)) && (mo>2)
+     )
+    day++;
+
+  return( day );
+} /*Function DOY*/
+
+/*------------------------------------------------------------------*/
+
+/* Fraction_of_Day calculates the fraction of */
+/* a day passed at the specified input time.  */
+double
+Fraction_of_Day(int hr,int mi,int se)
+{
+  return( (hr + (mi + se/60.0)/60.0)/24.0 );
+} /*Function Fraction_of_Day*/
+
+/*------------------------------------------------------------------*/
+
+/* The function Calendar_Date converts a Julian Date to a struct tm.   */
+/* Only the members tm_year, tm_mon and tm_mday are calculated and set */
+void
+Calendar_Date(double jd, struct tm *cdate)
+{
+  /* Astronomical Formulae for Calculators, Jean Meeus, pages 26-27 */
+  int Z,month;
+  double A,B,C,D,E,F,alpha,day,year,factor;
+
+  factor = 0.5/secday/1000;
+  F = Frac(jd + 0.5);
+  if (F + factor >= 1.0)
+    {
+      jd = jd + factor;
+      F  = 0.0;
+    } /*if*/
+  Z = Round(jd);
+  if( Z < 2299161 )
+    A = Z;
+  else
+    {
+      alpha = Int((Z - 1867216.25)/36524.25);
+      A = Z + 1 + alpha - Int(alpha/4);
+    } /*else*/
+  B = A + 1524;
+  C = Int((B - 122.1)/365.25);
+  D = Int(365.25 * C);
+  E = Int((B - D)/30.6001);
+  day = B - D - Int(30.6001 * E) + F;
+
+  if( E < 13.5 )
+    month = Round(E - 1);
+  else
+    month = Round(E - 13);
+  if( month > 2.5 )
+    year = C - 4716;
+  else
+    year = C - 4715;
+
+  cdate->tm_year = (int) year;
+  cdate->tm_mon = month;
+  cdate->tm_mday = (int) floor(day);
+
+} /*Function Calendar_Date*/
+
+/*------------------------------------------------------------------*/
+
+/* Time_of_Day takes a Julian Date and calculates the clock time */
+/* portion of that date. Only tm_hour, tm_min and tm_sec are set */
+void
+Time_of_Day(double jd, struct tm *cdate)
+{
+  int hr,mn,sc;
+  double _time;
+
+  _time = Frac(jd - 0.5)*secday;
+  _time = Round(_time);
+  hr = floor(_time/3600.0);
+  _time = _time - 3600.0*hr;
+  if( hr == 24 ) hr = 0;
+  mn = floor(_time/60.0);
+  sc = _time - 60.0*mn;
+  cdate->tm_hour = hr;
+  cdate->tm_min = mn;
+  cdate->tm_sec = sc;
+
+} /*Function Time_of_Day*/
+
+/*------------------------------------------------------------------*/
+
+/* The function Julian_Date converts a standard calendar   */
+/* date and time (FIXME: GMT?) to a Julian Date. The procedure Date_Time */
+/* performs the inverse of this function. */
+double
+Julian_Date(struct tm *cdate)
+{
+  double julian_date;
+
+  julian_date = Julian_Date_of_Year(cdate->tm_year) + 
+                DOY(cdate->tm_year,cdate->tm_mon,cdate->tm_mday) +
+                Fraction_of_Day(cdate->tm_hour,cdate->tm_min,cdate->tm_sec);
+
+  return( julian_date );
+} /*Function Julian_Date */
+
+/*------------------------------------------------------------------*/
+
+
+/*  Date_Time()
+ *
+ *  The function Date_Time() converts a Julian Date to
+ *  standard calendar date and time (GMT). The function
+ *  Julian_Date() performs the inverse of this function.
+ */
+
+void
+Date_Time(double julian_date, struct tm *cdate)
+{
+  time_t jtime;
+
+  jtime = (julian_date - 2440587.5)*86400.;
+  *cdate = *gmtime( &jtime );
+
+} /* End of Date_Time() */
+
+
+/*------------------------------------------------------------------*/
+
+/* The procedure Check_Date can be used as a check to see if a calendar    */
+/* date and time are valid. It works by first converting the calendar      */
+/* date and time to a Julian Date (which allows for irregularities, such   */
+/* as a time greater than 24 hours) and then converting back and comparing.*/
+int
+Check_Date(struct tm *cdate)
+{
+  double jt;
+  struct tm chkdate;
+
+  jt = Julian_Date(cdate);
+  Date_Time(jt, &chkdate);
+
+  if( (cdate->tm_year == chkdate.tm_year) &&
+      (cdate->tm_mon  == chkdate.tm_mon ) &&
+      (cdate->tm_mday == chkdate.tm_mday) &&
+      (cdate->tm_hour == chkdate.tm_hour) &&
+      (cdate->tm_min  == chkdate.tm_min ) &&
+      (cdate->tm_sec  == chkdate.tm_sec ) )
+    return ( 1 );
+  else
+    return( 0 );
+
+} /*Procedure Check_Date*/
+
+/*------------------------------------------------------------------*/
+
+/* Procedures Time_to_UTC and Time_from_UTC are used to  */
+/* convert 'struct tm' dates between UTC and local time. */
+/* The procedures JD_to_UTC and JD_from_UTC are used to  */
+/* do the same thing working directly with Julian dates. */
+
+struct tm
+Time_to_UTC(struct tm *cdate)
+{
+  time_t tdate;
+
+  tdate = mktime(cdate);
+  return( *gmtime(&tdate) );
+} /*Procedure Time_to_UTC*/
+
+/*------------------------------------------------------------------*/
+
+struct tm 
+Time_from_UTC(struct tm *cdate)
+{
+  time_t tdate;
+
+  tdate = mktime(cdate);
+  return( *localtime(&tdate) );
+} /*Procedure Time_from_UTC*/
+
+/*------------------------------------------------------------------*/
+
+/*
+ BSD systems don't define the timezone variable, so the following two
+ routines won't work.  They're not used anyway in the example main(),
+ so we might as well comment them out.  
+*/
+
+#if 0
+
+double
+JD_to_UTC(double jt)
+{
+  extern long timezone;
+  struct tm cdate;
+
+  time_t t = 0;
+
+  cdate = *localtime( &t );
+  jt = jt - timezone/secday;
+  if( cdate.tm_isdst )
+    jt= jt - 1.0/24.0;
+
+  return( jt );
+} /*Procedure JD_to_UTC*/
+
+/*------------------------------------------------------------------*/
+
+double
+JD_from_UTC(double jt)
+{
+  extern long timezone;
+  struct tm cdate;
+  time_t t = 0;
+
+  cdate = *localtime( &t );
+  jt = jt + timezone/secday;
+  if( cdate.tm_isdst )
+    jt= jt + 1.0/24.0;
+
+  return( jt );
+} /*Procedure JD_from_UTC*/
+
+#endif
+
+/*------------------------------------------------------------------*/
+
+/* The function Delta_ET has been added to allow calculations on   */
+/* the position of the sun.  It provides the difference between UT */
+/* (approximately the same as UTC) and ET (now referred to as TDT).*/
+/* This function is based on a least squares fit of data from 1950 */
+/* to 1991 and will need to be updated periodically. */
+
+double
+Delta_ET(double year)
+{
+  /* Values determined using data from 1950-1991 in the 1990 
+     Astronomical Almanac.  See DELTA_ET.WQ1 for details. */
+
+  double delta_et;
+
+  delta_et = 26.465 + 0.747622*(year - 1950) +
+             1.886913*sin(twopi*(year - 1975)/33);
+
+  return( delta_et );
+} /*Function Delta_ET*/
+
+/*------------------------------------------------------------------*/
+
+/* The function Julian_Date_of_Year calculates the Julian Date  */
+/* of Day 0.0 of {year}. This function is used to calculate the */
+/* Julian Date of any date by using Julian_Date_of_Year, DOY,   */
+/* and Fraction_of_Day. */
+
+double
+Julian_Date_of_Year(double year)
+{
+  /* Astronomical Formulae for Calculators, Jean Meeus, */
+  /* pages 23-25. Calculate Julian Date of 0.0 Jan year */
+
+  long A,B,i;
+  double jdoy;
+
+  year = year-1;
+  i = year/100;
+  A = i;
+  i = A/4;
+  B = 2-A+i;
+  i = 365.25*year;
+  i += 30.6001*14;
+  jdoy = i+1720994.5+B;
+
+  return (jdoy);
+}  /*Function Julian_Date_of_Year*/
+
+/*------------------------------------------------------------------*/
+
+/* The function ThetaG calculates the Greenwich Mean Sidereal Time */
+/* for an epoch specified in the format used in the NORAD two-line */
+/* element sets. It has now been adapted for dates beyond the year */
+/* 1999, as described above. The function ThetaG_JD provides the   */
+/* same calculation except that it is based on an input in the     */
+/* form of a Julian Date. */
+
+double
+ThetaG(double epoch, deep_arg_t *deep_arg)
+{
+/* Reference:  The 1992 Astronomical Almanac, page B6. */
+
+  double year,day,UT,jd,TU,GMST,_ThetaG;
+
+/* Modification to support Y2K */
+/* Valid 1957 through 2056     */
+  day = modf(epoch*1E-3,&year)*1E3;
+  if(year < 57)
+    year += 2000;
+  else
+    year += 1900;
+  /* End modification */
+
+  UT   = modf(day,&day);
+  jd   = Julian_Date_of_Year(year)+day;
+  TU   = (jd-2451545.0)/36525;
+  GMST = 24110.54841+TU*(8640184.812866+TU*(0.093104-TU* 6.2E-6));
+  GMST = Modulus(GMST+secday*omega_E*UT,secday);
+  _ThetaG = twopi*GMST/secday;
+  deep_arg->ds50 = jd-2433281.5+UT;
+  _ThetaG = FMod2p(6.3003880987*deep_arg->ds50+1.72944494);
+
+  return (_ThetaG);
+} /* Function ThetaG */
+
+/*------------------------------------------------------------------*/
+
+double
+ThetaG_JD(double jd)
+{
+/* Reference:  The 1992 Astronomical Almanac, page B6. */
+
+  double UT,TU,GMST;
+
+  UT   = Frac(jd + 0.5);
+  jd   = jd - UT;
+  TU   = (jd - 2451545.0)/36525;
+  GMST = 24110.54841 + TU * (8640184.812866 + TU * (0.093104 - TU * 6.2E-6));
+  GMST = Modulus(GMST + secday*omega_E*UT,secday);
+
+  return( twopi * GMST/secday );
+} /*Function ThetaG_JD*/
+
+/*------------------------------------------------------------------*/
+
+/* Gets calendar time from time() and produces a UTC calendar date */
+void
+UTC_Calendar_Now( struct tm *cdate )
+{
+  time_t t;
+
+  t = time(0);
+  *cdate = *gmtime(&t);
+  cdate->tm_year += 1900;
+  cdate->tm_mon += 1;
+
+} /* End UTC_Calendar_Now */
+/*------------------------------------------------------------------*/
diff -pruN 1.3-1/src/gtk-sat-module-tmg.c 1.3-1ubuntu1/src/gtk-sat-module-tmg.c
--- 1.3-1/src/gtk-sat-module-tmg.c	2011-02-26 20:26:28.000000000 +0000
+++ 1.3-1ubuntu1/src/gtk-sat-module-tmg.c	2011-07-19 23:47:15.000000000 +0000
@@ -483,7 +483,6 @@ static void tmg_time_set (GtkWidget *wid
     gdouble slider;
     gdouble jd;
 
-
     /* update time only if we are in manual time control */
     if (!mod->throttle && !mod->reset) {
 
@@ -513,7 +512,7 @@ static void tmg_time_set (GtkWidget *wid
         /* convert UTC time to Julian Date  */
         if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME)) {
             /* convert local time to UTC */
-            utim = Time_to_UTC (&tim);
+            Time_to_UTC (&tim, &utim);
 
             /* Convert to JD */
             jd = Julian_Date (&utim);
@@ -814,7 +813,7 @@ static void tmg_cal_add_one_day (GtkSatM
     /* convert UTC time to Julian Date  */
     if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME)) {
         /* convert local time to UTC */
-        utim = Time_to_UTC (&tim);
+        Time_to_UTC (&tim, &utim);
 
         /* Convert to JD */
         jd = Julian_Date (&utim);
@@ -869,7 +868,7 @@ static void tmg_cal_sub_one_day (GtkSatM
     /* convert UTC time to Julian Date  */
     if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME)) {
         /* convert local time to UTC */
-        utim = Time_to_UTC (&tim);
+        Time_to_UTC (&tim, &utim);
 
         /* Convert to JD */
         jd = Julian_Date (&utim);
diff -pruN 1.3-1/src/sgpsdp/sgp4sdp4.h 1.3-1ubuntu1/src/sgpsdp/sgp4sdp4.h
--- 1.3-1/src/sgpsdp/sgp4sdp4.h	2011-02-26 20:26:25.000000000 +0000
+++ 1.3-1ubuntu1/src/sgpsdp/sgp4sdp4.h	2011-07-19 23:47:15.000000000 +0000
@@ -347,7 +347,7 @@ void    Time_of_Day(double jd, struct tm
 double  Julian_Date(struct tm *cdate);
 void    Date_Time(double jd, struct tm *cdate);
 int     Check_Date(struct tm *cdate);
-struct tm Time_to_UTC(struct tm *cdate);
+void Time_to_UTC(struct tm *cdate, struct tm *odate);
 struct tm Time_from_UTC(struct tm *cdate);
 double  JD_to_UTC(double jt);
 double  JD_from_UTC(double jt);
diff -pruN 1.3-1/src/sgpsdp/sgp_time.c 1.3-1ubuntu1/src/sgpsdp/sgp_time.c
--- 1.3-1/src/sgpsdp/sgp_time.c	2011-02-26 20:26:25.000000000 +0000
+++ 1.3-1ubuntu1/src/sgpsdp/sgp_time.c	2011-07-19 23:47:15.000000000 +0000
@@ -241,13 +241,15 @@ Check_Date(struct tm *cdate)
 /* The procedures JD_to_UTC and JD_from_UTC are used to  */
 /* do the same thing working directly with Julian dates. */
 
-struct tm
-Time_to_UTC(struct tm *cdate)
+void
+Time_to_UTC(struct tm *cdate, struct tm *odate)
 {
   time_t tdate;
-
+  cdate->tm_year -= 1900;
+  cdate->tm_isdst = -1;
   tdate = mktime(cdate);
-  return( *gmtime(&tdate) );
+  gmtime_r(&tdate,odate);
+  odate->tm_year += 1900;
 } /*Procedure Time_to_UTC*/
 
 /*------------------------------------------------------------------*/

