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

Cleanup #127

Merged
merged 6 commits into from
Jan 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions __tests__/time.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,25 +277,6 @@ describe('time helper functions', function () {
expect(new Tag(oneThousandMS, 1).getLaterTag(straightZero).isSimultaneousWith(new Tag(oneThousandMS, 1))).toBeTruthy();
});

/**
* Get a time interval in a format that is understood by nanotimer.
*/
it('support for nanotimer (obsolete)', function() {
expect(TimeValue.secsAndNs(0 , 225).getNanoTime()).toEqual("225n");
expect(fiveSeconds.getNanoTime()).toEqual("5s");
expect(straightZero.getNanoTime()).toEqual("0s");
expect(fiveSFiveUS.getNanoTime()).toEqual("5000005u");
expect(TimeValue.secsAndNs(5, 5000000).getNanoTime()).toEqual("5005m");
expect(TimeValue.secsAndNs(5, 5).getNanoTime()).toEqual("5000000005n");
expect(fortyTwoDays.getNanoTime()).toEqual("3628800s");
expect(threeHundredUS.getNanoTime()).toEqual("300u");
expect(sevenPointFiveBillNS.getNanoTime()).toEqual("7500m");
expect(twoHundredFiftyMillMS.getNanoTime()).toEqual("250000s");
expect(fiveHundredMilNS.getNanoTime()).toEqual("500m");
expect(oneThousandMS.getNanoTime()).toEqual("1s");
expect(aboutTenYears.getNanoTime()).toEqual("315360000s");
})

/**
* Obtain the difference between two time values.
* Microstep indices are ignored in this operation
Expand Down
2 changes: 1 addition & 1 deletion lingua-franca-ref.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5710070e3913a4aaef1f8b839bbd7a89752adc93
master
35 changes: 35 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "0.2.0",
"description": "A reactor-oriented programming framework in TypeScript",
"main": "lib/core/index.js",
"types": "lib/core/index.d.ts",
"type": "commonjs",
"types": "src/core",
"dependencies": {
"@babel/cli": "^7.4.3",
"@babel/core": "^7.4.3",
Expand All @@ -16,6 +16,8 @@
"@babel/preset-typescript": "^7.7.7",
"@definitelytyped/header-parser": "0.0.29",
"@definitelytyped/typescript-versions": "0.0.29",
"@types/command-line-args": "^5.2.0",
"@types/command-line-usage": "^5.0.2",
"@types/jest": "^27.0.0",
"@types/microtime": "^2.1.0",
"@types/node": "^16.3.3",
Expand All @@ -32,6 +34,7 @@
"uuid": "^8.3.2"
},
"devDependencies": {
"@types/nanotimer": "^0.3.0",
"dtslint": "^3.4.2",
"jest": "^27.5.1",
"marked": ">=4.0.10",
Expand All @@ -44,7 +47,8 @@
"install": "npx rimraf lib && npx babel src --out-dir lib --extensions .ts",
"doc": "typedoc --out docs src/core/index.ts && touch docs/.nojekyll",
"dtslint": "dtslint __tests__/types",
"test": "jest --coverage"
"test": "jest --coverage",
"prepublish": "npx tsc"
},
"jest": {
"globals": {
Expand Down
8 changes: 0 additions & 8 deletions src/core/@types/command-line-args/index.d.ts

This file was deleted.

8 changes: 0 additions & 8 deletions src/core/@types/command-line-usage/index.d.ts

This file was deleted.

31 changes: 0 additions & 31 deletions src/core/@types/microtime/index.d.ts

This file was deleted.

52 changes: 0 additions & 52 deletions src/core/nanotimer.d.ts

This file was deleted.

51 changes: 0 additions & 51 deletions src/core/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,57 +253,6 @@ export class TimeValue {
public toTimeTuple(): [number, number] {
return [this.seconds, this.nanoseconds];
}

/**
* Get a string representation of this time value that is compatible with
* `nanotimer`. Unit specifiers are `s` for seconds, `m` for milliseconds
* `u` for microseconds, and `n` for nanoseconds.
* @see {@link https://www.npmjs.com/package/nanotimer} for further
* information.
*/
public getNanoTime(): string {

if (this.nanoseconds == 0) {
// Seconds.
return this.seconds.toString() + "s";
} else if (this.nanoseconds % 1000000 == 0) {
// Milliseconds.
let msecs = (this.nanoseconds / 1000000).toString();
if (this.seconds == 0) {
return msecs + "m";
} else {
let padding = "";
for (let i = 0; i < 3 - msecs.length; i++) {
padding += "0";
}
return this.seconds.toString() + padding + msecs + "m";
}
} else if (this.nanoseconds % 1000 == 0) {
// Microseconds.
let usecs = (this.nanoseconds/1000).toString();
if (this.seconds == 0) {
return usecs + "u";
} else {
let padding = "";
for (let i = 0; i < 6 - usecs.length; i++) {
padding += "0";
}
return this.seconds.toString() + padding + usecs + "u";
}
} else {
// Nanoseconds.
if (this.seconds == 0) {
return this.nanoseconds + "n";
} else {
let nsecs = this.nanoseconds.toString();
let padding = "";
for (let i = 0; i < 9 - nsecs.length; i++) {
padding += "0";
}
return this.seconds.toString() + padding + nsecs + "n";
}
}
}

/**
* Get a 64 bit binary, little endian representation of this TimeValue.
Expand Down