File tree Expand file tree Collapse file tree 2 files changed +4
-11
lines changed
src/main/scala/gitbucket/monitoring Expand file tree Collapse file tree 2 files changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,7 @@ class Linux extends SystemInformation with MachineResources with ProcessInfo wit
1010 val ut = (Process (" cat /proc/uptime" ) !! ).split(" " )
1111 val dt = Time .secondsToDateTime(Rounding .ceil(BigDecimal (ut(0 )),0 ).toInt)
1212 Right (UpTime (
13- dt match {
14- case Left (message) => (message)
15- case Right (l) => (l.days.toString + " days " + l.hours.toString + " hours " + l.minutes.toString + " minutes " )
16- },
13+ dt.days.toString + " days " + dt.hours.toString + " hours " + dt.minutes.toString + " minutes " ,
1714 Process (" uptime -s" ) !!
1815 ))
1916 } catch {
Original file line number Diff line number Diff line change @@ -19,15 +19,11 @@ object Time {
1919 minutes : Int
2020 )
2121
22- def secondsToDateTime (seconds : Int ): Either [String , DateTime ] = {
23- try {
24- Right (DateTime (
22+ def secondsToDateTime (seconds : Int ): DateTime = {
23+ DateTime (
2524 seconds / (60 * 60 * 24 ),
2625 ((seconds / (60 * 60 )) % 24 ) % 60 ,
2726 (seconds / 60 ) % 60
28- ))
29- } catch {
30- case e : Exception => Left (Message .error)
31- }
27+ )
3228 }
3329}
You can’t perform that action at this time.
0 commit comments