For DInt Data Type hh:mm:ss showing 0 value
-
CFTIMESPAN64 finalOutput(UtCf::toMsec(timeVar.toTime(), days.toULongLong()) * 10000);
emit varTypeValueChanged(CCfVariant(finalOutput), m_nElementId,
m_bProcessValueAvailable ? HmiPropertyID_ProcessValue : HmiPropertyID_Text);
TRACE_OUT_F(F::INFO, _MF(" onTimePickerOK m_textVal %1 finalOutput %2") << m_textVal << finalOutput); -
Hi,
What are the values you get ?
What are the results of your various computations ?
How are you getting these values ?
What are these methods you are using ?
Which version of Qt are you using ?
On which platform ? -
CFTIMESPAN64 is of int64 data type and I am getting output in hh:MM:ss with this but for int32
UtCf::toMsec(timeVar.toTime(), days.toULongLong()) * 10000 with this code I am getting 0 output
QT version is 5 -
My question is I want to take time input for every datatype but it is not working for int32_t
@Neku
But what has this to do with Qt? What does "take time input for every datatype" mean? How do whatever functions you have, about which we know nothing, deal with 32-bit values versus 64-bit? What value does yourint32_t * 10000
produce, is it representable in 32-bits at all? -
@Neku
And how should anyone but you know what adint
orLTime
input variable are? Or howUtCf::toMsec()
works/what it expects? Or what the problem is? Or how it's connected to Qt? Please think about the question you are asking....Or what about actually answering a question, instead of just asking the same thing?
What value does your
int32_t * 10000
produce, is it representable in 32-bits at all? -
Dint is Double integer: 32-bit signed integer (int32)
LTime is Double integer: 32-bit signed integer (int32)inline uint64_t toMsec(const QTime& time, const uint64_t days = 0)
{
return (days * 24 * 3600 * 1000) + (time.hour() * 3600 * 1000) + (time.minute() * 60 * 1000) +
(time.second() * 1000) + time.msec();
} -
Dint is Double integer: 32-bit signed integer (int32)
LTime is Double integer: 32-bit signed integer (int32)inline uint64_t toMsec(const QTime& time, const uint64_t days = 0)
{
return (days * 24 * 3600 * 1000) + (time.hour() * 3600 * 1000) + (time.minute() * 60 * 1000) +
(time.second() * 1000) + time.msec();
}qDebug() << days; uint64_t msec; msec = (days * 24 * 3600 * 1000) + (time.hour() * 3600 * 1000) + (time.minute() * 60 * 1000) + (time.second() * 1000) + time.msec(); qDebug() << (days * 24 * 3600 * 1000) << (time.hour() * 3600 * 1000) << (time.minute() * 60 * 1000) << (time.second() * 1000) << time.msec(); qDebug() << msec; return msec;
-
you have posted code for int64_t for which it is already weorking I want it to work for int32 as well what need to be done in that case that is my question
@Neku
I (almost) give up. You were supposed to try passing yourdint
orLTime
as the parameter from the caller to receive as theconst uint64_t days = 0
parameter to yourinline uint64_t toMsec(const QTime& time, const uint64_t days = 0)
You say that returns
0
. I showed what to paste in as the body with debug statements to see how it gets to that. I can't see why your existing code cannot handle input of 32-bit as well as 64-bit. -
Not getting output in hh:mm:ss format
int32_t day = 0;
QVARIANT timeVar;
int32_t timeOutput = (day * 24 * 3600 * 1000) + (timeVar.toTime().hour()* 3600 *1000)+ (timeVar.toTime().minute() * 60 * 1000) + (timeVar.toTime().second() * 1000) + timeVar.toTime().msec(); -
Not getting output in hh:mm:ss format
int32_t day = 0;
QVARIANT timeVar;
int32_t timeOutput = (day * 24 * 3600 * 1000) + (timeVar.toTime().hour()* 3600 *1000)+ (timeVar.toTime().minute() * 60 * 1000) + (timeVar.toTime().second() * 1000) + timeVar.toTime().msec();