Skip to content

Commit

Permalink
Implement GET _admin/time
Browse files Browse the repository at this point in the history
  • Loading branch information
pluma4345 committed Oct 9, 2023
1 parent 942aae4 commit 5dd743e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ This driver uses semantic versioning:

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

- Added `db.time` method to retrieve the server's system time

## [8.4.1] - 2023-09-15

### Fixed
Expand Down
14 changes: 14 additions & 0 deletions src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1866,6 +1866,19 @@ export class Database {
});
}

/**
* Retrives the server's current system time in milliseconds with microsecond
* precision.
*/
time(): Promise<number> {
return this.request(
{
path: "/_admin/time",
},
(res) => res.body.time * 1000
);
}

/**
* Returns a new {@link route.Route} instance for the given path (relative to the
* database) that can be used to perform arbitrary HTTP requests.
Expand Down Expand Up @@ -2081,6 +2094,7 @@ export class Database {
setResponseQueueTimeSamples(responseQueueTimeSamples: number) {
this._connection.setResponseQueueTimeSamples(responseQueueTimeSamples);
}

//#endregion

//#region auth
Expand Down

0 comments on commit 5dd743e

Please sign in to comment.