Skip to content

Commit 5dd743e

Browse files
committed
Implement GET _admin/time
1 parent 942aae4 commit 5dd743e

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ This driver uses semantic versioning:
2626

2727
- Added `db.shutdown` to initiate a clean shutdown of the server
2828

29+
- Added `db.time` method to retrieve the server's system time
30+
2931
## [8.4.1] - 2023-09-15
3032

3133
### Fixed

src/database.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,6 +1866,19 @@ export class Database {
18661866
});
18671867
}
18681868

1869+
/**
1870+
* Retrives the server's current system time in milliseconds with microsecond
1871+
* precision.
1872+
*/
1873+
time(): Promise<number> {
1874+
return this.request(
1875+
{
1876+
path: "/_admin/time",
1877+
},
1878+
(res) => res.body.time * 1000
1879+
);
1880+
}
1881+
18691882
/**
18701883
* Returns a new {@link route.Route} instance for the given path (relative to the
18711884
* database) that can be used to perform arbitrary HTTP requests.
@@ -2081,6 +2094,7 @@ export class Database {
20812094
setResponseQueueTimeSamples(responseQueueTimeSamples: number) {
20822095
this._connection.setResponseQueueTimeSamples(responseQueueTimeSamples);
20832096
}
2097+
20842098
//#endregion
20852099

20862100
//#region auth

0 commit comments

Comments
 (0)