Skip to content

Commit

Permalink
Merge pull request #329 from Agoric/328-timer-monotonicity-fix
Browse files Browse the repository at this point in the history
fix(timer): don't enforce advancement, just prevent moving backwards
  • Loading branch information
Chris-Hibbert authored Dec 12, 2019
2 parents 4719b47 + 7a0a509 commit 027d4b6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions packages/SwingSet/changelogs/328.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix timer interface to correspond to doc
prevent overly strict timer monotonicity
3 changes: 1 addition & 2 deletions packages/SwingSet/docs/timer.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ In `bootstrap()` for a particular SwingSet, we create a timerService, and
make it accessible to the user in `home`

```
await vats.timerWrapper~.registerTimerDevice(devices.timer);
const timerService = vats.timerWrapper~.createTimerService();
const timerService = vats.timerWrapper~.createTimerService(devices.timer);
```

Then users in the REPL can use the timerService to schedule wakeups.
Expand Down
4 changes: 2 additions & 2 deletions packages/SwingSet/src/devices/timer-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ export default function setup(syscall, state, helpers, endowments) {

function updateTime(time) {
insist(
time > lastPolled,
`Time is monotonic. ${time} must be greater than ${lastPolled}`,
time >= lastPolled,
`Time is monotonic. ${time} cannot be less than ${lastPolled}`,
);
lastPolled = time;
saveState();
Expand Down

0 comments on commit 027d4b6

Please sign in to comment.