Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os.uptime() may return fractional seconds #15

Closed
thom-nic opened this issue Mar 24, 2022 · 0 comments · Fixed by #16
Closed

os.uptime() may return fractional seconds #15

thom-nic opened this issue Mar 24, 2022 · 0 comments · Fixed by #16
Assignees

Comments

@thom-nic
Copy link

https://github.com/VoltServer/node-snmpjs/blob/develop/lib/mib/mib-2/system.js#L38

Ensure timeticks will always be an integer. Apparently it is not guaranteed that os.uptime() will always be a whole number. But this is platform (maybe node runtime?) dependent.

Re: nodejs/node#41636

This has been observed on arm32v7 Linux.

No fraction:

volt@voltserv-4209 ~
$ cat /etc/os-release  
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

volt@voltserv-4209 ~
$ node --version
v14.16.1

volt@voltserv-4209 ~
$ node
Welcome to Node.js v14.16.1.
Type ".help" for more information.
> os.uptime()
533791
> 

Fraction:

volt@voltserv-1be5 ~
$ /usr/local/bin/node --version
v14.18.2

volt@voltserv-1be5 ~
$ cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

volt@voltserv-1be5 ~
$ node
Welcome to Node.js v14.18.2.
Type ".help" for more information.
> os.uptime()
14204.11
> 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant