summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Poulain <benjamin.poulain@nokia.com>2009-06-29 13:49:29 (GMT)
committerBenjamin Poulain <benjamin.poulain@nokia.com>2009-06-29 14:02:51 (GMT)
commitcb7d8c7a199a6b9162b4d8181a3f9599a787fd9a (patch)
tree59e99a5abe916a4c9171b045cac0da6ac64249a0
parent82c48b13249fbcd96d8287f3cd1fdfd61802523c (diff)
downloadQt-cb7d8c7a199a6b9162b4d8181a3f9599a787fd9a.zip
Qt-cb7d8c7a199a6b9162b4d8181a3f9599a787fd9a.tar.gz
Qt-cb7d8c7a199a6b9162b4d8181a3f9599a787fd9a.tar.bz2
Initialize the time structure in QTime::currentTime()
In QTime::currentTime(), the pointer to the tm structure was used without being initialized. Task-number: 256889 Reviewed-by: Markus Goetz
-rw-r--r--src/corelib/tools/qdatetime.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 7dd9060..6674717 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -1848,8 +1848,7 @@ QTime QTime::currentTime()
#else
time_t ltime; // no millisecond resolution
::time(&ltime);
- tm *t = 0;
- localtime(&ltime);
+ const tm *const t = localtime(&ltime);
ct.mds = MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min + 1000 * t->tm_sec;
#endif
return ct;