Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. For DInt Data Type hh:mm:ss showing 0 value
Forum Updated to NodeBB v4.3 + New Features

For DInt Data Type hh:mm:ss showing 0 value

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
14 Posts 3 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Neku
    wrote on last edited by
    #1

    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);

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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 ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Neku
        wrote on last edited by
        #3

        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

        JonBJ 1 Reply Last reply
        0
        • N Neku

          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

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by
          #4

          @Neku
          You may be using Qt, but I do not see any Qt code here. Only C++. We don't know what CFTIMESPAN64, UtCf::toMsec(), CCfVariant etc. are. Or what your question is.

          1 Reply Last reply
          0
          • N Offline
            N Offline
            Neku
            wrote on last edited by
            #5

            My question is I want to take time input for every datatype but it is not working for int32_t

            JonBJ 1 Reply Last reply
            0
            • N Neku

              My question is I want to take time input for every datatype but it is not working for int32_t

              JonBJ Online
              JonBJ Online
              JonB
              wrote on last edited by JonB
              #6

              @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 your int32_t * 10000 produce, is it representable in 32-bits at all?

              1 Reply Last reply
              0
              • N Offline
                N Offline
                Neku
                wrote on last edited by
                #7

                I want to display time for both dint or LTime input variable

                JonBJ 1 Reply Last reply
                0
                • N Neku

                  I want to display time for both dint or LTime input variable

                  JonBJ Online
                  JonBJ Online
                  JonB
                  wrote on last edited by JonB
                  #8

                  @Neku
                  And how should anyone but you know what a dint or LTime input variable are? Or how UtCf::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?

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    Neku
                    wrote on last edited by
                    #9

                    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();
                    }

                    JonBJ 1 Reply Last reply
                    0
                    • N Neku

                      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();
                      }

                      JonBJ Online
                      JonBJ Online
                      JonB
                      wrote on last edited by
                      #10

                      @Neku

                      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;
                      
                      1 Reply Last reply
                      0
                      • N Offline
                        N Offline
                        Neku
                        wrote on last edited by
                        #11

                        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

                        JonBJ 1 Reply Last reply
                        0
                        • N Neku

                          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

                          JonBJ Online
                          JonBJ Online
                          JonB
                          wrote on last edited by JonB
                          #12

                          @Neku
                          I (almost) give up. You were supposed to try passing your dint or LTime as the parameter from the caller to receive as the const uint64_t days = 0 parameter to your

                          inline 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.

                          1 Reply Last reply
                          0
                          • N Offline
                            N Offline
                            Neku
                            wrote on last edited by Neku
                            #13

                            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();

                            JonBJ 1 Reply Last reply
                            0
                            • N Neku

                              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();

                              JonBJ Online
                              JonBJ Online
                              JonB
                              wrote on last edited by
                              #14

                              @Neku
                              I have suggested what you need to do to debug your situation. No more to say.

                              1 Reply Last reply
                              0

                              • Login

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Groups
                              • Search
                              • Get Qt Extensions
                              • Unsolved