mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 10:22:55 +00:00
initialize the timespec struct in do_gettime() function
in case of clock_gettime() failure the values may be random Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
c5e97acf49
commit
6558a31ae6
1 changed files with 2 additions and 2 deletions
|
@ -48,7 +48,7 @@ QElapsedTimer::ClockType QElapsedTimer::clockType()
|
|||
|
||||
static inline void do_gettime(qint64 *sec, qint64 *frac)
|
||||
{
|
||||
struct timespec ts;
|
||||
struct timespec ts = { 0, 0 };
|
||||
if (Q_LIKELY(QElapsedTimer::isMonotonic())) {
|
||||
::clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
} else {
|
||||
|
@ -112,7 +112,7 @@ qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const
|
|||
{
|
||||
qint64 secs = other.t1 - t1;
|
||||
qint64 fraction = other.t2 - t2;
|
||||
return (secs * Q_INT64_C(1000000000) + fraction) / Q_INT64_C(1000000);;
|
||||
return (secs * Q_INT64_C(1000000000) + fraction) / Q_INT64_C(1000000);
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const
|
||||
|
|
Loading…
Add table
Reference in a new issue