Comments (3)
Okay, this has been implemented in version 0.2.4. See Core::start_instant()
, i.e. cx.start_instant()
or whatever.
from stakker.
This got me thinking for the last couple of days. Internally the timers do use a relative time, i.e. elapsed time since runtime startup. However the only thing that is exposed is Instant
. It might be more consistent to invent a new time type MonoTime
which is internally like a Duration, and use that instead of Instant
for most things. For simulations you could start it at zero, which means that the elapsed time is easily available. For realtime, we'd need MonoTime
to be relative to some Instant
. If I switched to MonoTime
then that would simplify the timer code. Since I'm planning a rewrite of the timer queue at some point, it would make sense to do those changes together. This would be a breaking change, so it would be for 0.3. So that would be a cleaner longer-term change that makes all this time-handling easier. It would also be more efficient on platforms like MacOS that have awkward Instant implementations, i.e. where add/sub operations involve more complicated calculations.
However, in the meantime I can add a method to Core to get the Instant that the runtime started, so you could access it as cx.start_time()
, or something similar to that.
from stakker.
That would be great!
from stakker.
Related Issues (20)
- Macro to support `Actor<Box<dyn Trait>>` based actor creation HOT 1
- ActorOwnAnon type HOT 1
- Actor coroutines
- Consider small-Ret optimisation to avoid allocation
- Are there any benchmarks? HOT 1
- Real-world benchmarks
- Link the docs website from somewhere HOT 1
- Timer queue and time/duration overhaul
- `stakker_macros` linked from website doesn't exist HOT 3
- Can not initialise actor using fully qualified init method HOT 2
- Allow returning `Self` instead of `Option<Self>` for Prep methods that always go to Ready
- Means to make actor calls from another thread HOT 1
- Clarify timer contract
- Glommio: Consider writing interface code to run on top of it
- More beginner friendly tutorial? HOT 6
- Pass long path name to macro HOT 2
- ret_some_do! updating variables issue HOT 7
- An Actor implementing multiple traits? HOT 7
- Look into a no_std variant of stakker
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stakker.