[glibmm] Avoid compiler warning in TimeVal::as_double()
- From: Daniel Elstner <daniel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Avoid compiler warning in TimeVal::as_double()
- Date: Sun, 30 May 2010 22:53:56 +0000 (UTC)
commit f510673363137d691f5063bc68d9fa7bb3ef9709
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 b785a7b..17f373f 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-28 José Alburquerque <jaalburqu svn gnome org>
Settings: Add [get|set]_strv().
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]