How to print kernel time from command line?
113
Depending on your flavor of Unix, the /proc
filesystem may have an uptime file somewhere with the information you want.
Linux> cat /proc/uptime
5899847.37 23165596.55
And the output of the uptime
command for the same time:
Linux> uptime
16:46:27 up 68 days, 6:51, 3 users, load average: 0.01, 0.02, 0.05
So 5899847.37/86400 = 68.28527 --> 68 days, 6 hours, 51 minutes.
Related videos on Youtube
Author by
hwkd
Updated on September 18, 2022Comments
-
hwkd almost 2 years
so if I have something like this in C++:
char A_char = 'A'; char * myPtr = &A_char; const char * myPtr = &char_A; //pointers that point to constants char * const myPtr = &char_A; //constant pointers const char * const myPtr = &char_A; //constant pointers that point to constants
I was wondering where and why we use "pointers that point to constants", "constant pointers", and "constant pointers that point to constants" in programming. I know the differences between them and their syntax, but I have no idea where and why we use them. Would you be able to explain? Thanks guys.
-
mskfisher over 9 yearspossible duplicate of what is the difference between const int*, const int * const, int const *
-
Baldrickk over 9 yearsVery similar, but one is "What are they?" the other is "When do we use them?"
-
Neil Kirk over 9 years
const T*
is the most useful and common. It allows a function to read data only. By tightly controlling which parts of your program can modify data, it's easier to design your program and debug. -
risingDarkness over 9 yearspossible duplicate of Sell me on const correctness
-
EightBitTony over 8 yearsIt's still not clear what you're asking.
dmesg
output isn't seconds since the epoch. What problem are you trying to solve? Are you talking purely about 'time since boot' rather than epoch or kernel time?
-
-
tarabyte over 8 yearshow can i convert the uptime output to seconds since epoch to compare with dmesg output? does uptime have the same resolution as the kernel message time?
-
EightBitTony over 8 yearsOkay that's a completely different question, you might want to update your question to make that clear.