Skip to content

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

@hi2u

Description

@hi2u

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions