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

README.md demos as unix timestamps (since 1970) - but library is giving system uptime? #2

Open
hi2u opened this issue Mar 8, 2020 · 0 comments

Comments

@hi2u
Copy link

hi2u commented Mar 8, 2020

Looking at the example in README.md - it looks like μs.now() should be returning the unix timestamp with microseconds... i.e. the number of microseconds elapsed since 1970.

The example shows:

// 1404398280599786
// { microseconds: 786, milliseconds: 599, seconds: 0, minutes: 38, hours: 14, days: 16254 }

...which is: Thursday, 3 July 2014 2:38:00 PM UTC, which makes sense, as that was around the time when the package was first published.

But when I run the same code shown in the examples I don't get the time since 1970, I get the operating system's uptime instead.

Here's my code, which I can't see being any different from README.md:

const μs = require('microseconds');
const now = μs.now();
console.log(`Now is: `, now);
console.log(`Parsed is: `, μs.parse(now));
console.log(`Parsed is: `, μs.parse(now).toString());

I get the output:

Now is:  436458757931.173
Parsed is:  { microseconds: 931,
  milliseconds: 757,
  seconds: 18,
  minutes: 14,
  hours: 1,
  days: 5,
  toString: [Function: toString] }
Parsed is:  5 days 1 hour 14 minutes 18 seconds 757 milliseconds 931 microseconds

I get the same result on both Windows (Node v12.14.1) and Linux (Node v10.17.0).

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

No branches or pull requests

1 participant