@cobol-ts/time 0.0.13 → 0.0.16
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.
- package/README.md +16 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
# @cobol-ts/time
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Provide an injectable wall-clock millisecond function and a Promise-returning delay helper.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This is wall-clock time, not a monotonic nanosecond benchmark timer.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Example
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
```typescript
|
|
10
|
+
import {dateTimeService, delay} from '@cobol-ts/time'
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const startedAt = dateTimeService();
|
|
14
|
-
await delay(10);
|
|
15
|
-
const elapsedMs = dateTimeService() - startedAt;
|
|
12
|
+
const startedAt = dateTimeService()
|
|
13
|
+
await delay(10)
|
|
16
14
|
```
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
Inject `TimeService = () => number` when testing code that reads the current time. `dateTimeService()` returns epoch milliseconds, so do not use it to benchmark nanosecond-scale record operations.
|
|
17
|
+
|
|
18
|
+
## Source and tests
|
|
19
|
+
|
|
20
|
+
**Public entry points:** [time.service.ts](./src/time.service.ts).
|
|
21
|
+
|
|
22
|
+
**Tests:** [time.service.spec.ts](src/time.service.spec.ts)
|
|
23
|
+
|
|
24
|
+
**Related:** [@cobol-ts/cursor-loader-benchmark](../../cursor-loader/cursor-loader-benchmark/README.md) · [@cobol-ts/metrics](../metrics/README.md).
|