[Gpredict-svn] SF.net SVN: gpredict:[805] trunk
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
|
From: <cs...@us...> - 2011-04-01 11:48:11
|
Revision: 805
http://gpredict.svn.sourceforge.net/gpredict/?rev=805&view=rev
Author: csete
Date: 2011-04-01 11:48:05 +0000 (Fri, 01 Apr 2011)
Log Message:
-----------
Appied patch 3261586: Remove leading zero code from time formatting functions (thanks to Paul Schulz).
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/gtk-event-list.c
trunk/src/gtk-polar-view.c
trunk/src/gtk-rig-ctrl.c
trunk/src/gtk-rot-ctrl.c
trunk/src/pass-to-txt.c
trunk/src/sat-pass-dialogs.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2011-03-31 00:03:48 UTC (rev 804)
+++ trunk/ChangeLog 2011-04-01 11:48:05 UTC (rev 805)
@@ -1,3 +1,15 @@
+2011-04-01 Alexandru Csete <oz9aec at gmail.com>
+
+ * src/pass-to-txt.c
+ * src/sat-pass-dialogs.c
+ * src/gtk-rig-ctrl.c
+ * src/gtk-event-list.c
+ * src/gtk-rot-ctrl.c
+ * src/gtk-polar-view.c
+ Appied patch 3261586: Remove leading zero code from time formatting
+ functions (thanks to Paul Schulz).
+
+
2011-03-28 Charles Suprin <hamaa1vs at gmail.com>
* src/gtk-rig-ctrl.c
Modified: trunk/src/gtk-event-list.c
===================================================================
--- trunk/src/gtk-event-list.c 2011-03-31 00:03:48 UTC (rev 804)
+++ trunk/src/gtk-event-list.c 2011-04-01 11:48:05 UTC (rev 805)
@@ -577,7 +577,6 @@
guint coli = GPOINTER_TO_UINT (column);
guint h,m,s;
- gchar *ch,*cm,*cs;
/* get cell data */
@@ -596,39 +595,17 @@
h = (guint) floor (s/3600);
s -= 3600*h;
- /* leading zero */
- if ((h > 0) && (h < 10))
- ch = g_strdup ("0");
- else
- ch = g_strdup ("");
-
/* extract minutes */
m = (guint) floor (s/60);
s -= 60*m;
- /* leading zero */
- if (m < 10)
- cm = g_strdup ("0");
- else
- cm = g_strdup ("");
-
- /* leading zero */
- if (s < 10)
- cs = g_strdup (":0");
- else
- cs = g_strdup (":");
-
if (h > 0) {
- buff = g_strdup_printf ("%s%d:%s%d%s%d", ch, h, cm, m, cs, s);
+ buff = g_strdup_printf ("%02d:%02d:%02d", h, m, s);
}
else {
- buff = g_strdup_printf ("%s%d%s%d", cm, m, cs, s);
+ buff = g_strdup_printf ("%02d:%02d", m, s);
}
- g_free (ch);
- g_free (cm);
- g_free (cs);
-
}
/* render the cell */
Modified: trunk/src/gtk-polar-view.c
===================================================================
--- trunk/src/gtk-polar-view.c 2011-03-31 00:03:48 UTC (rev 804)
+++ trunk/src/gtk-polar-view.c 2011-04-01 11:48:05 UTC (rev 805)
@@ -677,7 +677,6 @@
gdouble number, now;
gchar *buff;
guint h,m,s;
- gchar *ch,*cm,*cs;
sat_t *sat = NULL;
gint *catnr;
@@ -721,34 +720,16 @@
h = (guint) floor (s/3600);
s -= 3600*h;
- /* leading zero */
- if ((h > 0) && (h < 10))
- ch = g_strdup ("0");
- else
- ch = g_strdup ("");
-
/* extract minutes */
m = (guint) floor (s/60);
s -= 60*m;
- /* leading zero */
- if (m < 10)
- cm = g_strdup ("0");
- else
- cm = g_strdup ("");
-
- /* leading zero */
- if (s < 10)
- cs = g_strdup (":0");
- else
- cs = g_strdup (":");
-
if (h > 0)
- buff = g_strdup_printf (_("Next: %s\nin %s%d:%s%d%s%d"),
- sat->nickname, ch, h, cm, m, cs, s);
+ buff = g_strdup_printf (_("Next: %s\nin %02d:%02d:%02d"),
+ sat->nickname, h, m, s);
else
- buff = g_strdup_printf (_("Next: %s\nin %s%d%s%d"),
- sat->nickname, cm, m, cs, s);
+ buff = g_strdup_printf (_("Next: %s\nin %02d:%02d"),
+ sat->nickname, m, s);
g_object_set (polv->next,
@@ -756,9 +737,6 @@
NULL);
g_free (buff);
- g_free (ch);
- g_free (cm);
- g_free (cs);
}
else {
sat_log_log (SAT_LOG_LEVEL_BUG,
@@ -1643,7 +1621,6 @@
static gchar *los_time_to_str (GtkPolarView *polv, sat_t *sat)
{
guint h,m,s;
- gchar *ch,*cm,*cs;
gdouble number, now;
gchar *text = NULL;
@@ -1658,37 +1635,16 @@
h = (guint) floor (s/3600);
s -= 3600*h;
- /* leading zero */
- if ((h > 0) && (h < 10))
- ch = g_strdup ("0");
- else
- ch = g_strdup ("");
-
/* extract minutes */
m = (guint) floor (s/60);
s -= 60*m;
- /* leading zero */
- if (m < 10)
- cm = g_strdup ("0");
- else
- cm = g_strdup ("");
-
- /* leading zero */
- if (s < 10)
- cs = g_strdup (":0");
- else
- cs = g_strdup (":");
-
if (h > 0) {
- text = g_strdup_printf (_("LOS in %s%d:%s%d%s%d"), ch, h, cm, m, cs, s);
+ text = g_strdup_printf (_("LOS in %02d:%02d:%02d"), h, m, s);
}
else {
- text = g_strdup_printf (_("LOS in %s%d%s%d"), cm, m, cs, s);
+ text = g_strdup_printf (_("LOS in %02d:%02d"), m, s);
}
- g_free (ch);
- g_free (cm);
- g_free (cs);
return text;
}
Modified: trunk/src/gtk-rig-ctrl.c
===================================================================
--- trunk/src/gtk-rig-ctrl.c 2011-03-31 00:03:48 UTC (rev 804)
+++ trunk/src/gtk-rig-ctrl.c 2011-04-01 11:48:05 UTC (rev 805)
@@ -2244,7 +2244,6 @@
gdouble delta;
gchar *buff;
guint h,m,s;
- gchar *ch,*cm,*cs;
gchar *aoslos;
@@ -2267,42 +2266,21 @@
h = (guint) floor (s/3600);
s -= 3600*h;
- /* leading zero */
- if ((h > 0) && (h < 10))
- ch = g_strdup ("0");
- else
- ch = g_strdup ("");
-
/* extract minutes */
m = (guint) floor (s/60);
s -= 60*m;
- /* leading zero */
- if (m < 10)
- cm = g_strdup ("0");
- else
- cm = g_strdup ("");
-
- /* leading zero */
- if (s < 10)
- cs = g_strdup (":0");
- else
- cs = g_strdup (":");
-
if (h > 0)
- buff = g_strdup_printf ("<span size='xx-large'><b>%s %s%d:%s%d%s%d</b></span>",
- aoslos, ch, h, cm, m, cs, s);
+ buff = g_strdup_printf ("<span size='xx-large'><b>%s %02d:%02d:%02d</b></span>",
+ aoslos, h, m, s);
else
- buff = g_strdup_printf ("<span size='xx-large'><b>%s %s%d%s%d</b></span>",
- aoslos, cm, m, cs, s);
+ buff = g_strdup_printf ("<span size='xx-large'><b>%s %02d:%02d</b></span>",
+ aoslos, m, s);
gtk_label_set_markup (GTK_LABEL (ctrl->SatCnt), buff);
g_free (buff);
g_free (aoslos);
- g_free (ch);
- g_free (cm);
- g_free (cs);
}
Modified: trunk/src/gtk-rot-ctrl.c
===================================================================
--- trunk/src/gtk-rot-ctrl.c 2011-03-31 00:03:48 UTC (rev 804)
+++ trunk/src/gtk-rot-ctrl.c 2011-04-01 11:48:05 UTC (rev 805)
@@ -1225,7 +1225,6 @@
gdouble delta;
gchar *buff;
guint h,m,s;
- gchar *ch,*cm,*cs;
/* select AOS or LOS time depending on target elevation */
@@ -1243,39 +1242,18 @@
h = (guint) floor (s/3600);
s -= 3600*h;
- /* leading zero */
- if ((h > 0) && (h < 10))
- ch = g_strdup ("0");
- else
- ch = g_strdup ("");
-
/* extract minutes */
m = (guint) floor (s/60);
s -= 60*m;
- /* leading zero */
- if (m < 10)
- cm = g_strdup ("0");
- else
- cm = g_strdup ("");
-
- /* leading zero */
- if (s < 10)
- cs = g_strdup (":0");
- else
- cs = g_strdup (":");
-
if (h > 0)
- buff = g_strdup_printf ("%s%d:%s%d%s%d", ch, h, cm, m, cs, s);
+ buff = g_strdup_printf ("%02d:%02d:%02d", h, m, s);
else
- buff = g_strdup_printf ("%s%d%s%d", cm, m, cs, s);
+ buff = g_strdup_printf ("%02d:%02d", m, s);
gtk_label_set_text (GTK_LABEL (ctrl->SatCnt), buff);
g_free (buff);
- g_free (ch);
- g_free (cm);
- g_free (cs);
}
Modified: trunk/src/pass-to-txt.c
===================================================================
--- trunk/src/pass-to-txt.c 2011-03-31 00:03:48 UTC (rev 804)
+++ trunk/src/pass-to-txt.c 2011-04-01 11:48:05 UTC (rev 805)
@@ -567,7 +567,6 @@
/* Duration */
if (fields & (1 << MULTI_PASS_COL_DURATION)) {
guint h,m,s;
- gchar *ch,*cm,*cs;
/* convert julian date to seconds */
s = (guint) ((pass->los - pass->aos) * 86400);
@@ -576,35 +575,14 @@
h = (guint) floor (s/3600);
s -= 3600*h;
- /* leading zero */
- if (h < 10)
- ch = g_strdup ("0");
- else
- ch = g_strdup ("");
-
/* extract minutes */
m = (guint) floor (s/60);
s -= 60*m;
- /* leading zero */
- if (m < 10)
- cm = g_strdup (":0");
- else
- cm = g_strdup (":");
-
- /* leading zero */
- if (s < 10)
- cs = g_strdup (":0");
- else
- cs = g_strdup (":");
-
- buff = g_strdup_printf ("%s %s%d%s%d%s%d", line, ch, h, cm, m, cs, s);
+ buff = g_strdup_printf ("%s %02d:%02d:%02d", line, h, m, s);
g_free (line);
line = g_strdup (buff);
g_free (buff);
- g_free (ch);
- g_free (cm);
- g_free (cs);
}
/* Max El */
Modified: trunk/src/sat-pass-dialogs.c
===================================================================
--- trunk/src/sat-pass-dialogs.c 2011-03-31 00:03:48 UTC (rev 804)
+++ trunk/src/sat-pass-dialogs.c 2011-04-01 11:48:05 UTC (rev 805)
@@ -1226,7 +1226,6 @@
gchar *buff;
guint coli = GPOINTER_TO_UINT (column);
guint h,m,s;
- gchar *ch,*cm,*cs;
@@ -1246,39 +1245,17 @@
h = (guint) floor (s/3600);
s -= 3600*h;
- /* leading zero */
- if (h < 10)
- ch = g_strdup ("0");
- else
- ch = g_strdup ("");
-
/* extract minutes */
m = (guint) floor (s/60);
s -= 60*m;
- /* leading zero */
- if (m < 10)
- cm = g_strdup (":0");
- else
- cm = g_strdup (":");
+ buff = g_strdup_printf ("%02d:%02d:%02d", h, m, s);
- /* leading zero */
- if (s < 10)
- cs = g_strdup (":0");
- else
- cs = g_strdup (":");
-
-
- buff = g_strdup_printf ("%s%d%s%d%s%d", ch, h, cm, m, cs, s);
-
g_object_set (renderer,
"text", buff,
NULL);
g_free (buff);
- g_free (ch);
- g_free (cm);
- g_free (cs);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|