aboutsummaryrefslogtreecommitdiff
path: root/sysutils/byobu/files/patch-usr_lib_byobu_uptime
blob: 25efa2075fb40db806be3ecb3e4f5dbf21b06439 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
--- usr/lib/byobu/uptime.orig	2016-05-31 14:48:13 UTC
+++ usr/lib/byobu/uptime
@@ -30,6 +30,9 @@ __uptime() {
 	if [ -r /proc/uptime ]; then
 		read u idle < /proc/uptime
 		u=${u%.*}
+	elif [ $(uname) = "FreeBSD" ]; then
+		u=$(sysctl -n kern.boottime | sed -En 's:.*sec = ([[:digit:]]+),.*:\1:p')
+		u=$(($(date +%s) - $u))
 	elif [ -x /usr/sbin/sysctl ]; then
 		# MacOS support
 		u=$(/usr/sbin/sysctl -n kern.boottime | cut -f4 -d' ' | cut -d',' -f1)