[glibmm/glibmm-2-24] Avoid compiler warning in TimeVal::as_double()



commit 5dabbc18913738b4b0dd0277442f95474bcb7a1b
Author: Daniel Elstner <danielk openismus com>
Date:   Mon May 31 00:50:50 2010 +0200

    Avoid compiler warning in TimeVal::as_double()
    
    * glib/glibmm/timeval.h (TimeVal::as_double): Cast long int operands
    to double explicitly, to avoid a conversion warning due to possible
    loss of precision.  Reported by Alexander Shaduri, GNOME bug #617463.

 ChangeLog             |    8 ++++++++
 glib/glibmm/timeval.h |    2 +-
 2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 08d6d6b..85c3539 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-05-30  Daniel Elstner  <danielk openismus com>
+
+	Avoid compiler warning in TimeVal::as_double()
+
+	* glib/glibmm/timeval.h (TimeVal::as_double): Cast long int operands
+	to double explicitly, to avoid a conversion warning due to possible
+	loss of precision.  Reported by Alexander Shaduri, GNOME bug #617463.
+
 2010-05-25  José Alburquerque  <jaalburqu svn gnome org>
 
 	Add _IGNORE's for g_iconv().
diff --git a/glib/glibmm/timeval.h b/glib/glibmm/timeval.h
index 685f783..8897ee1 100644
--- a/glib/glibmm/timeval.h
+++ b/glib/glibmm/timeval.h
@@ -157,7 +157,7 @@ TimeVal& TimeVal::operator-=(long seconds)
 inline
 double TimeVal::as_double() const
 {
-  return tv_sec + ((double) tv_usec / (double) G_USEC_PER_SEC);
+  return double(tv_sec) + double(tv_usec) / double(G_USEC_PER_SEC);
 }
 
 inline



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]