systeminformation 5.23.9 → 5.23.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/osinfo.js +19 -5
  2. package/package.json +1 -1
package/lib/osinfo.js CHANGED
@@ -34,11 +34,25 @@ const _sunos = (_platform === 'sunos');
34
34
 
35
35
  function time() {
36
36
  let t = new Date().toString().split(' ');
37
- return {
38
- current: Date.now(),
39
- uptime: os.uptime(),
40
- timezone: (t.length >= 7) ? t[5] : '',
41
- timezoneName: Intl ? Intl.DateTimeFormat().resolvedOptions().timeZone : (t.length >= 7) ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : ''
37
+ if (_darwin || _linux) {
38
+ const stdout = execSync('date +%Z && date +%z && ls -l /etc/localtime 2>/dev/null', util.execOptsLinux);
39
+ const lines = stdout.toString().split(os.EOL);
40
+ if (lines.length > 3 && !lines[0]) {
41
+ lines.shift();
42
+ }
43
+ return {
44
+ current: Date.now(),
45
+ uptime: os.uptime(),
46
+ timezone: lines[0] && lines[1] ? lines[0] + lines[1] : '',
47
+ timezoneName: lines[2] && lines[2].indexOf('/zoneinfo/') > 0 ? (lines[2].split('/zoneinfo/')[1] || '') : ''
48
+ };
49
+ } else {
50
+ return {
51
+ current: Date.now(),
52
+ uptime: os.uptime(),
53
+ timezone: (t.length >= 7) ? t[5] : '',
54
+ timezoneName: Intl ? Intl.DateTimeFormat().resolvedOptions().timeZone : (t.length >= 7) ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : ''
55
+ };
42
56
  };
43
57
  }
44
58
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.23.9",
3
+ "version": "5.23.10",
4
4
  "description": "Advanced, lightweight system and OS information library",
5
5
  "license": "MIT",
6
6
  "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",