--- ./plugins/ps/ps.py_orig	2011-08-10 10:20:19 -0500
+++ ./plugins/ps/ps.py	2017-09-11 11:32:23 -0500
@@ -40,6 +40,28 @@
 requires_api_version = '2.5'
 plugin_type = (TYPE_INTERACTIVE,)
 
+def sys_boottime():
+    up_proc = subprocess.Popen("uptime",
+                                  stdout=subprocess.PIPE,
+                                  shell=True)
+    (op, error) = up_proc.communicate()
+    op = op.split()
+    days = int(op[2])
+    hm = op[4].split(':')
+    if len(hm) == 2:
+        hrs = int (hm[0])
+        mn = int(hm[1].strip(','))
+    elif len(hm) == 1:
+        hrs = 0
+        mn = int(hm[0])
+    ds = days * 86400
+    hs = hrs * 3600
+    ms = mn * 60
+    ts = ds + hs + ms
+    epoch_time = int(time.time())
+    boot_time = epoch_time - ts
+    return boot_time
+
 def _rpmdb_return_running_packages(self, return_pids=False):
     """returns a list of yum installed package objects which own a file
        that are currently running or in use."""
@@ -92,15 +114,13 @@
             kern_pkgs = base.rpmdb.searchNames([kern_pkgtup[0]])
             if kern_pkgs:
                 kern_latest = sorted(kern_pkgs)[-1]
-                if kern_latest.verGT(kern_pkg):
-                    pkgs[kern_latest] = [0]
+                #if kern_latest.verGT(kern_pkg):
+                #    pkgs[kern_latest] = [0]
 
         try:
             # Get boot time, this is what get_process_info() uses:
-            for line in open("/proc/stat"):
-                if line.startswith("btime "):
-                    kern_boot = int(line[len("btime "):-1])
-                    break
+            # For AIX get it using uptime command.
+            kern_boot =  sys_boottime() 
         except:
             kern_boot = 0
 
@@ -159,12 +179,16 @@
                 continue
             print "%s %s %s" % (pkg, state, apkgs)
             for start_time, pid, ps_info in sorted(procs):
-                ago = utils.seconds_to_ui_time(now - start_time)
+                #ago = utils.seconds_to_ui_time(now - start_time)
+                ago = utils.seconds_to_ui_time(start_time)
                 nr = ' '
+                epoch_time = int(time.time())
+                start_time = epoch_time - start_time 
                 if start_time <= pkg.installtime:
                     nr = '*'
                 name = ps_info['name']
-                cpu  = int(ps_info['utime']) + int(ps_info['stime'])
+                #cpu  = int(ps_info['utime']) + int(ps_info['stime'])
+                cpu  = int(ps_info['cutime'])
                 cpu  = "%d:%02d" % (cpu / 60, cpu % 60)
                 rss  = format_number(int(ps_info['vmrss']) * 1024)
                 S    = ps_info['state']
