Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
neofetch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
neofetch
Commits
86cfc366
Commit
86cfc366
authored
Oct 21, 2016
by
Dylan Araps
Committed by
GitHub
Oct 21, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #383 from konimex/uptime-fix
Solaris: Rewritten uptime
parents
99d43ff2
e4c7f192
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
39 deletions
+36
-39
neofetch
neofetch
+36
-39
No files found.
neofetch
View file @
86cfc366
...
...
@@ -268,55 +268,52 @@ getkernel() {
# Uptime {{{
getuptime() {
# Get uptime in seconds
case "
$os
" in
"
Linux
" | "
Windows
" | "
Mac
OS X
" | "
iPhone
OS
" | "
BSD
")
# Get uptime in seconds
case "
$os
" in
"
Linux
" | "
Windows
")
seconds="
$(
< /proc/uptime
)
"
seconds="
${
seconds
/.*
}
"
;;
"
Mac
OS X
" | "
iPhone
OS
" | "
BSD
")
boot="
$(
sysctl
-n
kern.boottime
)
"
boot="
${
boot
/
'{ sec = '
}
"
boot="
${
boot
/,*
}
"
"
Linux
" | "
Windows
")
seconds="
$(
< /proc/uptime
)
"
seconds="
${
seconds
/.*
}
"
;;
# Get current date in seconds
now="
$(
date
+%s
)
"
seconds="
$((
now
-
boot
))
"
;;
esac
"
Mac
OS X
" | "
iPhone
OS
" | "
BSD
")
boot="
$(
sysctl
-n
kern.boottime
)
"
boot="
${
boot
/
'{ sec = '
}
"
boot="
${
boot
/,*
}
"
days="
$((
seconds
/
60
/
60
/
24
))
days
"
hours="
$((
seconds
/
60
/
60
%
24
))
hours
"
minutes="
$((
seconds
/
60
%
60
))
minutes
"
# Get current date in seconds
now="
$(
date
+%s
)
"
seconds="
$((
now
-
boot
))
"
;;
case "
$days
" in
"
0
days
") unset days ;;
"
1
days
") days="
${
days
/s
}
" ;;
esac
"
Solaris
")
seconds="
$(
kstat
-p
unix:0:system_misc:snaptime |
awk
'{print $2}'
)
"
seconds="
${
seconds
/.*
}
"
;;
esac
case "
$hours
" in
"
0
hours
") unset hours ;;
"
1
hours
") hours="
${
hours
/s
}
" ;;
esac
days="
$((
seconds
/
60
/
60
/
24
))
days
"
hours="
$((
seconds
/
60
/
60
%
24
))
hours
"
minutes="
$((
seconds
/
60
%
60
))
minutes
"
case "
$minute
s
" in
"
0
minutes
") unset minute
s ;;
"
1
minutes
") minutes="
${
minute
s
/s
}
" ;;
esac
case "
$day
s
" in
"
0
days
") unset day
s ;;
"
1
days
") days="
${
day
s
/s
}
" ;;
esac
uptime="
${
days
:+
$days
,
}${
hours
:+
$hours
,
}${
minutes
}
"
uptime="
${
uptime
%
', '
}
"
uptime="
up
${
uptime
:-${
seconds
}
seconds
}
"
;;
case "
$hours
" in
"
0
hours
") unset hours ;;
"
1
hours
") hours="
${
hours
/s
}
" ;;
esac
"
Solaris
")
uptime="
$(
uptime
| /usr/xpg4/bin/awk
-F
':[0-9]{2}+[a-z][a-z] |(, ){1}+'
'{printf $2}'
)
"
;;
case "
$minutes
" in
"
0
minutes
") unset minutes ;;
"
1
minutes
") minutes="
${
minutes
/s
}
"
;;
esac
uptime="
${
days
:+
$days
,
}${
hours
:+
$hours
,
}${
minutes
}
"
uptime="
${
uptime
%
', '
}
"
uptime="
up
${
uptime
:-${
seconds
}
seconds
}
"
# Make the output of uptime smaller.
case "
$uptime_shorthand
" in
"
on
")
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment