Should use sysinfo struct instead of running uptime command #2

Closed
opened 2014-01-30 19:24:24 +00:00 by Nicd · 1 comment
Nicd commented 2014-01-30 19:24:24 +00:00 (Migrated from gitlab.com)

Created by: Nicd

Currently the uptime is retrieved with the uptime command and the output is parsed with a regex. This is unreliable (uptime format may change) and a clumsy way overall.

The sysinfo struct described on http://man7.org/linux/man-pages/man2/sysinfo.2.html should be used instead. Reading the struct will also have better performance since no additional processes are spawned.

*Created by: Nicd* Currently the uptime is retrieved with the uptime command and the output is parsed with a regex. This is unreliable (uptime format may change) and a clumsy way overall. The sysinfo struct described on [http://man7.org/linux/man-pages/man2/sysinfo.2.html](http://man7.org/linux/man-pages/man2/sysinfo.2.html) should be used instead. Reading the struct will also have better performance since no additional processes are spawned.
Nicd commented 2014-02-01 23:09:15 +00:00 (Migrated from gitlab.com)

Created by: Nicd

Get uptime from sys/sysinfo.h instead of parsing uptime output. Fixes #2

→ <<cset 0c463f24bf88>>

*Created by: Nicd* Get uptime from sys/sysinfo.h instead of parsing uptime output. Fixes #2 → <<cset 0c463f24bf88>>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: nicd/SailTime#2
No description provided.