diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6fd0530..f61f627 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -82,6 +82,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
+| 5.16.3 | 2022-12-09 | `processes()` fix started (linux alpine) |
| 5.16.3 | 2022-12-08 | `users()` fix when multiple explorer.exe (windows) |
| 5.16.2 | 2022-12-08 | `dockerContainerStats()` improved calculation cpuPercent |
| 5.16.1 | 2022-12-04 | code cleanup, moved from lgtm to GitHub Code Scan |
diff --git a/docs/history.html b/docs/history.html
index 780394a..297e15e 100644
--- a/docs/history.html
+++ b/docs/history.html
@@ -57,9 +57,14 @@
+
+ | 5.16.4 |
+ 2022-12-09 |
+ processes() fix started (linux alpine) |
+
| 5.16.3 |
- 2022-12-04 |
+ 2022-12-08 |
users() fix when multiple exporer.exe opened (windows) |
diff --git a/docs/index.html b/docs/index.html
index 8b34bb8..ea114b9 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -170,7 +170,7 @@
systeminformation
- New Version: 5.16.3
+ New Version: 5.16.4
diff --git a/lib/processes.js b/lib/processes.js
index 4622683..912365e 100644
--- a/lib/processes.js
+++ b/lib/processes.js
@@ -655,7 +655,7 @@ function processes(callback) {
function formatDateTime(time) {
const month = ('0' + (time.getMonth() + 1).toString()).substr(-2);
const year = time.getFullYear().toString();
- const day = ('0' + time.getDay().toString()).substr(-2);
+ const day = ('0' + time.getDate().toString()).substr(-2);
const hours = time.getHours().toString();
const mins = time.getMinutes().toString();
const secs = ('0' + time.getSeconds().toString()).substr(-2);
@@ -663,6 +663,21 @@ function processes(callback) {
return (year + '-' + month + '-' + day + ' ' + hours + ':' + mins + ':' + secs);
}
+ function parseElapsed(etime) {
+ let started = '';
+ if (etime.indexOf('d') >= 0) {
+ const elapsed_parts = etime.split('d');
+ started = formatDateTime(new Date(Date.now() - (elapsed_parts[0] * 24 + elapsed_parts[1] * 1) * 60 * 60 * 1000));
+ } else if (etime.indexOf('h') >= 0) {
+ const elapsed_parts = etime.split('h');
+ started = formatDateTime(new Date(Date.now() - (elapsed_parts[0] * 60 + elapsed_parts[1] * 1) * 60 * 1000));
+ } else if (etime.indexOf(':') >= 0) {
+ const elapsed_parts = etime.split(':');
+ started = formatDateTime(new Date(Date.now() - (elapsed_parts.length > 1 ? (elapsed_parts[0] * 60 + elapsed_parts[1]) * 1000 : elapsed_parts[0] * 1000)));
+ }
+ return started;
+ }
+
let result = [];
lines.forEach(function (line) {
if (line.trim() !== '') {
@@ -670,8 +685,7 @@ function processes(callback) {
const parts = line.split(' ');
const command = parts.slice(9).join(' ');
const pmem = parseFloat((1.0 * parseInt(parts[3]) * 1024 / os.totalmem()).toFixed(1));
- const elapsed_parts = parts[5].split(':');
- const started = formatDateTime(new Date(Date.now() - (elapsed_parts.length > 1 ? (elapsed_parts[0] * 60 + elapsed_parts[1]) * 1000 : elapsed_parts[0] * 1000)));
+ const started = parseElapsed(parts[5]);
result.push({
pid: parseInt(parts[0]),