Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to store total power on time in nonvoltile memory in linux using qt/qml using c++ ?
Forum Updated to NodeBB v4.3 + New Features

How to store total power on time in nonvoltile memory in linux using qt/qml using c++ ?

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 7 Posters 722 Views 3 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.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on last edited by
    #1

    I want to know how we can store total power on time count in minute to store in non volatile memory.

    can any body know how to implement above thing in qt/qml using c++ ?

    jsulmJ M 2 Replies Last reply
    0
    • Q Qt embedded developer

      @Christian-Ehrlicher i don't know how to find total power on time ?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by J.Hilk
      #6

      @Qt-embedded-developer not, that you actually stated that in the OP, but AFAIK linux has the
      last boot or uptime - depends on your actual linux flavour- command that returns the time of the last reboot. QProcess is your friend in actually executing that command


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      Q 1 Reply Last reply
      3
      • Q Qt embedded developer

        I want to know how we can store total power on time count in minute to store in non volatile memory.

        can any body know how to implement above thing in qt/qml using c++ ?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @Qt-embedded-developer said in How to store total power on time in nonvoltile memory in linux using qt/qml using c++ ?:

        can any body know how to implement above thing in qt/qml using c++ ?

        You really should provide more information/better description - how else can anybody know? What device is that and what exactly is this "nonvoltile memory"?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        Q 1 Reply Last reply
        1
        • jsulmJ jsulm

          @Qt-embedded-developer said in How to store total power on time in nonvoltile memory in linux using qt/qml using c++ ?:

          can any body know how to implement above thing in qt/qml using c++ ?

          You really should provide more information/better description - how else can anybody know? What device is that and what exactly is this "nonvoltile memory"?

          Q Offline
          Q Offline
          Qt embedded developer
          wrote on last edited by Qt embedded developer
          #3

          @jsulm my device is like intel pc. on which we installed liunx os. on this linux pc installed qt/qml.

          Non volatile memory means file on hard disk.

          Christian EhrlicherC 1 Reply Last reply
          0
          • Q Qt embedded developer

            @jsulm my device is like intel pc. on which we installed liunx os. on this linux pc installed qt/qml.

            Non volatile memory means file on hard disk.

            Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @Qt-embedded-developer said in How to store total power on time in nonvoltile memory in linux using qt/qml using c++ ?:

            Non volatile memory means file on hard disk.

            What's wrong with QFile?

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            Q 1 Reply Last reply
            1
            • Christian EhrlicherC Christian Ehrlicher

              @Qt-embedded-developer said in How to store total power on time in nonvoltile memory in linux using qt/qml using c++ ?:

              Non volatile memory means file on hard disk.

              What's wrong with QFile?

              Q Offline
              Q Offline
              Qt embedded developer
              wrote on last edited by
              #5

              @Christian-Ehrlicher i don't know how to find total power on time ?

              J.HilkJ M 2 Replies Last reply
              0
              • Q Qt embedded developer

                @Christian-Ehrlicher i don't know how to find total power on time ?

                J.HilkJ Offline
                J.HilkJ Offline
                J.Hilk
                Moderators
                wrote on last edited by J.Hilk
                #6

                @Qt-embedded-developer not, that you actually stated that in the OP, but AFAIK linux has the
                last boot or uptime - depends on your actual linux flavour- command that returns the time of the last reboot. QProcess is your friend in actually executing that command


                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                Q 1 Reply Last reply
                3
                • Q Qt embedded developer

                  @Christian-Ehrlicher i don't know how to find total power on time ?

                  M Offline
                  M Offline
                  mpergand
                  wrote on last edited by mpergand
                  #7

                  @Qt-embedded-developer

                  Struggling with std::chrono a bit :)
                  It seems you can get the "system tick" since last boot:

                  using namespace std;
                  
                  chrono::steady_clock::time_point t1 = chrono::steady_clock::now();
                  auto seconds = chrono::duration_cast<chrono::seconds>(t1.time_since_epoch()).count();
                  
                  qDebug()<<seconds/3600.0; // hours since this computer runs
                  
                  1 Reply Last reply
                  1
                  • Q Qt embedded developer

                    I want to know how we can store total power on time count in minute to store in non volatile memory.

                    can any body know how to implement above thing in qt/qml using c++ ?

                    M Offline
                    M Offline
                    mchinand
                    wrote on last edited by
                    #8

                    It's not entirely clear what time you want to report; current uptime or the total time the system has ever been on (that's how interpret your use of 'total'). If the latter, you may want to look at the info reported by system disk's SMART data using smartctl. Of course, that is strictly the disk's data and not necessarily the computer's 'total power on time' if the system disk has been replaced or moved from another system.

                    1 Reply Last reply
                    0
                    • J.HilkJ J.Hilk

                      @Qt-embedded-developer not, that you actually stated that in the OP, but AFAIK linux has the
                      last boot or uptime - depends on your actual linux flavour- command that returns the time of the last reboot. QProcess is your friend in actually executing that command

                      Q Offline
                      Q Offline
                      Qt embedded developer
                      wrote on last edited by
                      #9

                      @J-Hilk How we can find count of total power on time in linux?

                      jsulmJ Kent-DorfmanK 2 Replies Last reply
                      0
                      • Q Qt embedded developer

                        @J-Hilk How we can find count of total power on time in linux?

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #10

                        @Qt-embedded-developer Didn't @J-Hilk answer that already?

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        3
                        • Q Qt embedded developer

                          @J-Hilk How we can find count of total power on time in linux?

                          Kent-DorfmanK Offline
                          Kent-DorfmanK Offline
                          Kent-Dorfman
                          wrote on last edited by Kent-Dorfman
                          #11

                          @Qt-embedded-developer

                          re - total power up time...

                          You can't, at least not on a typical intel PC. You can read /proc/uptime to determine seconds since last reboot, but that doesn't count power on time before reboot, which is different than power up time.

                          I light my way forward with the fires of all the bridges I've burned behind me.

                          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