How to store total power on time in nonvoltile memory in linux using qt/qml using c++ ?
-
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++ ?
-
@Christian-Ehrlicher i don't know how to find total power on time ?
@Qt-embedded-developer not, that you actually stated that in the OP, but AFAIK linux has the
last bootoruptime- depends on your actual linux flavour- command that returns the time of the last reboot. QProcess is your friend in actually executing that command -
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++ ?
@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"?
-
@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"?
@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.
-
@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.
@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-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?
@Christian-Ehrlicher i don't know how to find total power on time ?
-
@Christian-Ehrlicher i don't know how to find total power on time ?
@Qt-embedded-developer not, that you actually stated that in the OP, but AFAIK linux has the
last bootoruptime- depends on your actual linux flavour- command that returns the time of the last reboot. QProcess is your friend in actually executing that command -
@Christian-Ehrlicher i don't know how to find total power on time ?
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 -
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++ ?
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.
-
@Qt-embedded-developer not, that you actually stated that in the OP, but AFAIK linux has the
last bootoruptime- depends on your actual linux flavour- command that returns the time of the last reboot. QProcess is your friend in actually executing that command@J-Hilk How we can find count of total power on time in linux?
-
@J-Hilk How we can find count of total power on time in linux?
@Qt-embedded-developer Didn't @J-Hilk answer that already?
-
@J-Hilk How we can find count of total power on time in linux?
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.