mirror of
https://github.com/badaix/snapcast.git
synced 2025-07-20 18:07:34 +02:00
added uptime
This commit is contained in:
parent
de8c4e4ea2
commit
f546738d75
1 changed files with 45 additions and 41 deletions
|
@ -34,6 +34,8 @@
|
|||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <iomanip>
|
||||
#include <sys/sysinfo.h>
|
||||
|
||||
|
||||
// trim from start
|
||||
static inline std::string <rim(std::string &s)
|
||||
|
@ -86,6 +88,14 @@ static std::string getHostName()
|
|||
}
|
||||
|
||||
|
||||
static long uptime()
|
||||
{
|
||||
struct sysinfo info;
|
||||
sysinfo(&info);
|
||||
return info.uptime;
|
||||
}
|
||||
|
||||
|
||||
static std::string getMacAddress(int sock)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
|
@ -126,12 +136,6 @@ static std::string getMacAddress(int sock)
|
|||
(unsigned char)ifr.ifr_hwaddr.sa_data[3], (unsigned char)ifr.ifr_hwaddr.sa_data[4], (unsigned char)ifr.ifr_hwaddr.sa_data[5]);
|
||||
return mac;
|
||||
}
|
||||
/* std::ifstream t("/sys/class/net/eth0/address");
|
||||
std::string str((std::istreambuf_iterator<char>(t)),
|
||||
std::istreambuf_iterator<char>());
|
||||
return trim(str);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue